NSAccessibilityPressAction on NSMenuItem

2014-07-12 Thread Remco Poelstra
Hi,

I'm trying to perform an NSAccessibilityPressAction on a NSMenuItem in my own 
app.
Currently I've this:
[[[NSApplication sharedApplication].menu itemAtIndex:2] 
accessibilityPerformAction:NSAccessibilityPressAction];
I get back an unrecognised selector sent message.
When I try to traverse the accessibility objects using
   [[NSApplication sharedApplication] 
accessibilityAttributeValue:NSAccessibilityMenuBarAttribute];
I get back a plain NSMenu, to which I also can not send any accessibility 
messages. The inspector on the other hand seems to be able to get to an 
AXMenuItem and send the press action to it.
How do I get that AXMenuItem? Or how can I send the press action to a menu item?

Thanks in advance.

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simulating sublayers in CATiledLayer

2014-03-26 Thread Remco Poelstra

Finally it works!
I now have a CALayer backed UIView with CATiledLayer sublayers with full 
zooming support.
I'm not entirely sure what change actually turned it into something 
working, but I'm happy it does work now.


Thanks for all support.

Remco

Graham Cox schreef op 26-3-2014 1:04:

Did you notice what David Duncan said?:


For CATiledLayer you need to ensure the levelOfDetail and levelOfDetailBias is 
set correctly


This is crucial to being able to zoom properly. It's also not that obvious what 
these mean or the proper values to use, but there was a discussion about this 
back in December or so if I recall correctly (search for 'Threaded drawing'), 
which expounded on this. I got CATiledLayer zooming to work as expected with 
vector content remaining sharp, but only once these properties had been 
understood and set.


--Graham


On 26 Mar 2014, at 4:55 am, Remco Poelstra re...@beryllium.net wrote:


Well, the parent CATiledLayer (the UIViews's layer) uses transforms for 
zooming, but that isn't communicated down the sublayers. The context of the 
sublayers is simply scaled.
All I've done is set the UIView layer class to CATiledLayer. Add the UIView to 
a UIScrollview. And added sub CA(Tiled)Layers to the CATiledLayer of the UIView.
The transform is applied to the root layer, and not to the sublayers.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simulating sublayers in CATiledLayer

2014-03-25 Thread Remco Poelstra

David Duncan schreef op 24-3-2014 20:41:
On Mar 22, 2014, at 2:18 AM, Remco Poelstra re...@beryllium.net 
mailto:re...@beryllium.net wrote:



How can I make sure that some custom drawing method get's called?


Call -setNeedsDisplay on the layer (layers are valid by default)


Hi,

I tried that, but it only draws the layer once. When I zoom in, the 
content becomes pixelated. I tried to subclass CATiledLayer and override 
-setAffineTransform to set the contentsScale of all sub layers depending 
on the current transform, but that gives all sorts of drawing errors.
Is there a way to keep the custom drawn content sharp? Like with 
CAShapeLayers?


Thanks in advance.

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simulating sublayers in CATiledLayer

2014-03-25 Thread Remco Poelstra

Hi,

No, it doesn't. The zooming is done by changing the transform of the 
tiled layer, scrolling changes the bounds of the tiled layer.


Remco

Sandor Szatmari schreef op 25-3-2014 12:14:

Remco,

I don't know if zooming the layer counts as a change in the layer's bounds, but 
if your not already doing so, you could try calling 
-setNeedsDisplayOnBoundsChange: with YES.

Sandor


On Mar 25, 2014, at 4:56, Remco Poelstra re...@beryllium.net wrote:

David Duncan schreef op 24-3-2014 20:41:

On Mar 22, 2014, at 2:18 AM, Remco Poelstra re...@beryllium.net 
mailto:re...@beryllium.net wrote:

How can I make sure that some custom drawing method get's called?

Call -setNeedsDisplay on the layer (layers are valid by default)

Hi,

I tried that, but it only draws the layer once. When I zoom in, the content 
becomes pixelated. I tried to subclass CATiledLayer and override 
-setAffineTransform to set the contentsScale of all sub layers depending on the 
current transform, but that gives all sorts of drawing errors.
Is there a way to keep the custom drawn content sharp? Like with CAShapeLayers?

Thanks in advance.

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/admin.szatmari.net%40gmail.com

This email sent to admin.szatmari@gmail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simulating sublayers in CATiledLayer

2014-03-25 Thread Remco Poelstra

 Op 25 mrt. 2014 om 17:25 heeft David Duncan david.dun...@apple.com het 
 volgende geschreven:
 
 On Mar 25, 2014, at 1:56 AM, Remco Poelstra re...@beryllium.net wrote:
 
 David Duncan schreef op 24-3-2014 20:41:
 On Mar 22, 2014, at 2:18 AM, Remco Poelstra re...@beryllium.net wrote:
 
 How can I make sure that some custom drawing method get's called?
 
 
 Call -setNeedsDisplay on the layer (layers are valid by default)
 
 Hi,
 
 I tried that, but it only draws the layer once. When I zoom in, the content 
 becomes pixelated. I tried to subclass CATiledLayer and override 
 -setAffineTransform to set the contentsScale of all sub layers depending on 
 the current transform, but that gives all sorts of drawing errors.
 Is there a way to keep the custom drawn content sharp? Like with 
 CAShapeLayers?
 
 Is this a CATiledLayer or a CALayer? CALayers don’t redraw like this when you 
 zoom, and while there are a few techniques for doing this yourself, you have 
 to be fairly careful to avoid huge memory spikes.
 
 For CATiledLayer you need to ensure the levelOfDetail and levelOfDetailBias 
 is set correctly, but that should be about it.
 
 CAShapeLayers redraw automatically because they are vector content and as 
 such can be resized. CALayers and CATiledLayers display bitmap content – 
 tiled layers only get shaper because they are designed to maintain multiple 
 levels of detail.

I've tried with both CALayer and CATiledLayer sublayers, but the CATiledLayer 
also did not redraw (at higher resolution) when its parent layer has a 
transform. I think because the sublayer knows nothing about the transform of 
the parent layer.
I'm also uncertain about the best moment to call setneedsdisplay on the 
sublayers when zooming and panning.

Remco
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simulating sublayers in CATiledLayer

2014-03-25 Thread Remco Poelstra

Op 25 mrt. 2014 om 17:59 heeft Kyle Sluder k...@ksluder.com het volgende 
geschreven:

 On Mar 25, 2014, at 9:50 AM, Remco Poelstra re...@beryllium.net wrote:
 
 I've tried with both CALayer and CATiledLayer sublayers, but the 
 CATiledLayer also did not redraw (at higher resolution) when its parent 
 layer has a transform.
 
 Sounds like your solution involves ceasing the use of transforms for zooming.

Well, the parent CATiledLayer (the UIViews's layer) uses transforms for 
zooming, but that isn't communicated down the sublayers. The context of the 
sublayers is simply scaled.
All I've done is set the UIView layer class to CATiledLayer. Add the UIView to 
a UIScrollview. And added sub CA(Tiled)Layers to the CATiledLayer of the UIView.
The transform is applied to the root layer, and not to the sublayers.

Remco
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simulating sublayers in CATiledLayer

2014-03-22 Thread Remco Poelstra
Hi,

So, I've been experimenting with sublayers of CATiledLayer and this indeed does 
work.
I've created a CALayer which contains CAShapeLayers for all the paths. It all 
looks great, but the performance is horrible. It seems there is no bounds 
checking on the CAShapeLayers, so it tries to draw them all for each tile.
I've tried to draw the paths directly into the sublayers, but for some reason 
none of the custom drawing functions is called. Not for a CALayer subclass, nor 
if I set a delegate for the sublayer.
I create the sublayers in the following way:
-
CustomLayer *subLayer=[CustomLayer new];

subLayer.bounds=bounds; //bounds is calculated somewhere above

//let the anchorpoint correspond to (0,0) in our space
subLayer.anchorPoint=CGPointMake(-bounds.origin.x/bounds.size.width, 
-bounds.origin.y/bounds.size.height);

//Add a cross at (0,0), for debugging purposes
CAShapeLayer *shape=[CAShapeLayer new];
CGMutablePathRef path=CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, -5, 0);
CGPathAddLineToPoint(path, NULL, 5, 0);
CGPathMoveToPoint(path, NULL, 0, -5);
CGPathAddLineToPoint(path, NULL, 0, 5);
shape.path=path;
shape.fillColor=nil;
shape.strokeColor=[UIColor yellowColor].CGColor;

subLayer.sublayers=subLayers; //subLayers is an array of CAShapeLayers
[subLayer  addSublayer:shape];

return subLayer;
-
How can I make sure that some custom drawing method get's called?

Thanks in advance.

Kind regards,

Remco Poelstra

Op 21 mrt. 2014, om 21:22 heeft Remco Poelstra re...@beryllium.net het 
volgende geschreven:
 
 I'm working on an iOS app which needs to draw paths. Drawing is performed 
 in layers, each layer having its own color. Some paths add (opaque) 
 content, while some paths remove content (i.e. draw in a clear color). 
 Content removal should only happen on a per layer basis. This model fits 
 exactly with CALayer, with a CALayer for each drawing layer.
 The drawing layers can contain up to 3 paths.
 Since I want to be able to zoom in, I'm using CATiledLayer. Unfortunately 
 CATiledLayer does not allow sub layers.
 
 Thats news. What makes you believe this?
 
 The internet did. But it is not true, is it? At least apple docs don't say it 
 is not possible. Then I wonder will it solve the problem of trying to draw 
 everything for each tile? Seems I've new options to try tomorrow :)
 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Simulating sublayers in CATiledLayer

2014-03-21 Thread Remco Poelstra
Hi,

I'm working on an iOS app which needs to draw paths. Drawing is performed in 
layers, each layer having its own color. Some paths add (opaque) content, while 
some paths remove content (i.e. draw in a clear color). Content removal should 
only happen on a per layer basis. This model fits exactly with CALayer, with a 
CALayer for each drawing layer.
The drawing layers can contain up to 3 paths.
Since I want to be able to zoom in, I'm using CATiledLayer. Unfortunately 
CATiledLayer does not allow sub layers.
Now I can create a container layer which contains all the drawing layers as 
sublayers and call [containerLayer renderInContext:], to render it to the 
CATiledLayer, but it will render the complete layer for each and every tile. So 
performance drops considerably. I also noticed that this route only works with 
CAShapeLayers for each path. A custom drawInContext: does not get invoked.
If I render all paths directly to the CATiledLayer and check the bounding boxes 
against the clipbox I get reasonable performance, but paths drawn in clear 
color will remove all content below them, not only content from the same 
drawing layer.
Is there some way to render a container layer to a CATiledLayer while keeping 
any knowledge about the clipping path (i.e. skipping over any paths which are 
outside the clip bounds)?

Thanks in advance.

Kind regards,

Remco Poelstra


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Simulating sublayers in CATiledLayer

2014-03-21 Thread Remco Poelstra

 Op 21 mrt. 2014 om 17:28 heeft David Duncan david.dun...@apple.com het 
 volgende geschreven:
 
 
 On Mar 21, 2014, at 3:53 AM, Remco Poelstra re...@beryllium.net wrote:
 
 Hi,
 
 I'm working on an iOS app which needs to draw paths. Drawing is performed in 
 layers, each layer having its own color. Some paths add (opaque) content, 
 while some paths remove content (i.e. draw in a clear color). Content 
 removal should only happen on a per layer basis. This model fits exactly 
 with CALayer, with a CALayer for each drawing layer.
 The drawing layers can contain up to 3 paths.
 Since I want to be able to zoom in, I'm using CATiledLayer. Unfortunately 
 CATiledLayer does not allow sub layers.
 
 Thats news. What makes you believe this?

The internet did. But it is not true, is it? At least apple docs don't say it 
is not possible. Then I wonder will it solve the problem of trying to draw 
everything for each tile? Seems I've new options to try tomorrow :)

Regards,

Remco Poelstra 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Separators line between table view cells is inonsistent

2014-01-27 Thread Remco Poelstra

Rick Mann schreef op 28-1-2014 0:25:

I have a grouped-style table view, with a section that is populated dynamically 
with the results of a Bluetooth LE scan. As items appear in the middle of the 
list (they're sorted by name), sometimes the separating line between cells 
doesn't draw or draws an inconsistent length.

Any idea what might be causing this? The cells are custom, but straightforward 
in that they're just made up of UILabel and UIActivityIndicator views, using 
autolayout in a storyboard.


It seems this is a bug in iOS7. I've the same problems. Even Mail 
doesn't draw the separators correctly at all times. I hope they will fix 
it in 7.1.


Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: File association using file magic

2014-01-24 Thread Remco Poelstra

Op 22 jan. 2014, om 15:33 heeft Remco Poelstra re...@beryllium.net het 
volgende geschreven:

 I'm writing an app which has to import files without a fixed file extension. 
 There are about 10 different commonly used file extensions around.
 Is it possible to associate a file to my app based on the file contents? Much 
 like how file (1) determines a file's type?
 Or should I simply register all know file extensions?


Thanks for both responses. I think I'll try to do both. Register all known file 
extensions, so the known ones get a nice document icon and the suggestion to 
open it with my app. And accept all other types, just in case someone comes up 
with a new extension. I think that will be the most useful to users.

Regards,

Remco Poelstra


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

File association using file magic

2014-01-23 Thread Remco Poelstra

Hi,

I'm writing an app which has to import files without a fixed file 
extension. There are about 10 different commonly used file extensions 
around.
Is it possible to associate a file to my app based on the file contents? 
Much like how file (1) determines a file's type?

Or should I simply register all know file extensions?

Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

UIView size after rotation

2011-03-30 Thread Remco Poelstra
Hi,

In my UIVIewController 
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
 duration:(NSTimeInterval)duration, I need to know the size of the view after 
it's rotated. Is there a way to calculate it if it can not be requested? The 
view's bounds are still in the old orientation, although the orientation 
property is already updated.
Thanks in advance.

Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UITabBarController calls viewDidAppear

2011-03-21 Thread Remco Poelstra
Hi,

I've a UITabBarController. with two tabs, that's loaded from the 
MainWindow.xib. It's UINavigationControllers are in the same NIB, which load 
their UITableViewControllers from external NIB's (as recommended by Apple).
The tableview in the first tab loads in its tableView:didSelectRowAtIndexPath 
the same tableview as the second would (but with different properties). This is 
the same behaviour as the iPod application, where the artist tableview loads an 
album view, but you can also show albums from the tab bar controller (showing a 
different set of albums).
When the second tableview is loaded from the first tableview, everything works 
fine. When the second tableview is loaded directly in the second tab, 
viewDidAppear is called long before the view is shown. The tableView therefore 
did not have time to fully initialize (and call numberOfRowsInSection:) and 
crashes on a wrong row insert command in viewDidAppear.

How can I find out why the viewDidAppear is called to early?

Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: rewriting observed keyPath

2011-02-16 Thread Remco Poelstra

Op 15 feb 2011, om 23:59 heeft Quincey Morris het volgende geschreven:

 On Feb 15, 2011, at 11:27, Kyle Sluder wrote:
 
 As long as -current and -preset0 return the same object, and that
 object is KVO-compliant for @parameters, then observing
 @current.parameters and @preset0.parameters are equivalent.
 
 Kyle beat me to the punch on this part of the answer, but there's one 
 additional point -- the preferences controller *also* needs to be KVO 
 compliant with current, otherwise changing current will leave observers 
 of current.parameters out of date. The OP's originally posted attempt at an 
 implementation of the current property wasn't KVO compliant, but the 
 version I suggested was.
 

Thanks for the insights. It works fine now.
Leaves me wondering how that KVO registering works, how does the runtime now 
that it's the same path that is monitored? Especially in the situation where 
the full keyPath might not yet exist. You can still register for it and be 
notified as soon as it's created.

Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: rewriting observed keyPath

2011-02-16 Thread Remco Poelstra

Op 16 feb 2011, om 11:39 heeft Quincey Morris het volgende geschreven:

 On Feb 16, 2011, at 00:19, Remco Poelstra wrote:
 
 Leaves me wondering how that KVO registering works, how does the runtime now 
 that it's the same path that is monitored?
 
 Actually, there's no magic involved* -- it's kind of obvious**, in the sense 
 that it has to work this way***, even if the process is a bit complicated. If 
 you're interested, here are the gory details:

Thanks! That enlightens!

Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


rewriting observed keyPath

2011-02-15 Thread Remco Poelstra
Hi,

I've a PresetsController which holds a dictionary containing preset settings 
for my application. The presets contain trees (Mutable Dictionaries) of keys.
To save the GUI code from bothering with tracking the current preset, I want to 
give my PresetController the option to replace a keyPath like 
@current.parameter.subparameter.value to 
@preset2.parameter.subparameter.value.
I implemented it with a valueForUndefinedKey:
- (id) valueForUndefinedKey:(NSString *)key {
if ([key isEqual:@current])
return [presets valueForKey:currentPreset]; //presets is a 
NSMutableDicitonary, currentPreset a NSString
else
return [presets valueForKey:key];
}

, returning the dictionary belonging to the current preset. This works for 
setting and reading using keyPaths. It does not work for observing a keyPath 
like @current.parameter.subparameter.value. How should I implement that? I 
tried monitoring all keyPaths in the dictionaries, and than calling [self 
will/didChange] like:
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object 
change:(NSDictionary *)change context:(void *)context {
NSString *newKeyPath=[keyPath 
stringByReplacingOccurrencesOfString:currentPreset withString:@current];

if ([keyPath hasPrefix:currentPreset]) {
if ([[change 
valueForKey:NSKeyValueChangeNotificationIsPriorKey] boolValue])
[self willChangeValueForKey:newKeyPath];
else
[self didChangeValueForKey:newKeyPath];
}
}

but this doesn't trigger anything. If I replace newKeyPath with @current than 
all observers will get a trigger, independent of any (sub)parameters.
What would be the correct way to trigger the observers?

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: rewriting observed keyPath

2011-02-15 Thread Remco Poelstra

Hi,

Thanks for your reply.
The problem with this solution is that when I do a setValue:object  
forKeyPath:@preset0.parameter, and @preset0 is the current preset,  
than no KVO message is sent to observers observing the @current  
variant of the keyPath. That would only happen, if they used the  
actual @current.parameters keyPath.

Maybe KVO doesn't support this at all, I'm just hope it will :)

Regards,

Remco Poelstra

Op 15 feb 2011, om 19:51 heeft Quincey Morris het volgende geschreven:


On Feb 15, 2011, at 05:11, Remco Poelstra wrote:

I've a PresetsController which holds a dictionary containing  
preset settings for my application. The presets contain trees  
(Mutable Dictionaries) of keys.
To save the GUI code from bothering with tracking the current  
preset, I want to give my PresetController the option to replace a  
keyPath like @current.parameter.subparameter.value to  
@preset2.parameter.subparameter.value.

I implemented it with a valueForUndefinedKey:
- (id) valueForUndefinedKey:(NSString *)key {
if ([key isEqual:@current])
		return [presets valueForKey:currentPreset]; //presets is a  
NSMutableDicitonary, currentPreset a NSString

else
return [presets valueForKey:key];
}

, returning the dictionary belonging to the current preset. This  
works for setting and reading using keyPaths. It does not work for  
observing a keyPath like @current.parameter.subparameter.value.  
How should I implement that?


I think you're making this too hard. If you need to observe a key  
path that includes the current key, then just define a [derived]  
current property for the presets controller (assuming that's the  
class that has the above code). The getter would look like this:


- (NSDictionary*) current {
return [presets valueForKey:currentPreset];
}

The only thing you have to do is make sure that current is KVO  
compliant, which means that notifications need to be sent out  
whenever the underlying value changes:


[self willChangeValueForKey: @current];
currentPreset = ...
[self didChangeValueForKey: @current];

wherever you change the current preset. There are other possible  
variations, depending on what's most convenient with your class:


1. Obviously you could vary this by keeping a pointer to the current  
preset dictionary in an instance variable too.


2. If currentPreset is itself a KVO compliant property, you don't  
need to generate KVO notifications manually (the second code  
fragment). Instead, you'd use:


+ (NSSet*) keyPathsForValuesAffectingCurrent {
return [NSSet setWithObject: @currentPreset];
}

and write:

self.currentPreset = ...




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UITextField not shrinking text

2011-02-01 Thread Remco Poelstra
Hi,

When I set an UILabel to adjustFontSizeToFitWidth=YES with a fontSize of 10, 
the label behaves as expected when I place long text in the label. When I do 
the same for an UITextField, the text shrinks a bit, but not to font size 10. 
Does anybody know why that is?

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Link to Settings.App

2011-01-24 Thread Remco Poelstra
Hi,

How can I link to the settings app on iOS? If the user did not configure the 
WiFi, I want to switch the user to the Wifi settings pane. I know it's 
possible, since the app from the local railway corporation does the same thing 
(except for a different page inside the app). I just can't find any reference 
on how to do that.
Can anybody point me in the right direction?

Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mutable to-many relationship not observable

2011-01-17 Thread Remco Poelstra

Op 15-1-2011 9:19, Ken Thomases schreef:

Which will/didChange... methods do you use, when you've tested the manual 
notifications?

Also, what does your -observeValueForKeyPath:ofObject:change:context: method 
look like?

My suspicion is that you're using will/didChangeValueForKey: and your 
observe... method is expecting the value of the NSKeyValueChangeKindKey to be 
NSKeyValueChangeSetting.

Instead, the automatic notifications from the mutating indexed accessors is 
more akin to what's generated by will/didChange:valuesAtIndexes:forKey:, and 
NSKeyValueChangeKindKey will be one of NSKeyValueChangeInsertion, 
NSKeyValueChangeRemoval, or NSKeyValueChangeReplacement.



Your suspicion was right. I had implemented it completely the wrong way. 
Works perfect now. Thanks.


Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Mutable to-many relationship not observable

2011-01-14 Thread Remco Poelstra
Hi,

I've a property digiDevices that's a to-many relationship. I've implemented the 
value write accesors (in addition to the read ones, which behave perfect):
- (void) insertObject:(DigiDevice *)digiDevice 
inDigiDevicesAtIndex:(NSUInteger)index {
[digiDevices insertObject:digiDevice atIndex:index];
}

- (void) removeObjectFromDigiDevicesAtIndex:(NSUInteger)index {
[digiDevices removeObjectAtIndex:index];
}

When I modify the relationship through mutableArrayValueForKey: the object is 
correctly removed, but no notification is send to objects observing the array. 
The KVC Guide states that I get automatic KVO by implementing these methods.
Is there something I did wrong?

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Mutable to-many relationship not observable

2011-01-14 Thread Remco Poelstra
Hi,

I add the observer as follows:
[[DigiDevicesManager sharedDigiDevicesManager] addObserver:self 
forKeyPath:@digiDevices options:NSKeyValueObservingOptionOld context:nil];
It's superclass is NSObject and I did not disable automatic notifications.

If mutate the array (from inside the observed object) with [self 
{will/did}change..] then everything works fine.

Regards,

Remco Poelstra

Op 14 jan 2011, om 12:11 heeft Mike Abdullah het volgende geschreven:

 Show us your code that adds the observer. Also, what is the superclass of 
 this class?
 
 On 14 Jan 2011, at 10:45, Remco Poelstra wrote:
 
 Hi,
 
 I've a property digiDevices that's a to-many relationship. I've implemented 
 the value write accesors (in addition to the read ones, which behave 
 perfect):
 - (void) insertObject:(DigiDevice *)digiDevice 
 inDigiDevicesAtIndex:(NSUInteger)index {
  [digiDevices insertObject:digiDevice atIndex:index];
 }
 
 - (void) removeObjectFromDigiDevicesAtIndex:(NSUInteger)index {
  [digiDevices removeObjectAtIndex:index];
 }
 
 When I modify the relationship through mutableArrayValueForKey: the object 
 is correctly removed, but no notification is send to objects observing the 
 array. The KVC Guide states that I get automatic KVO by implementing these 
 methods.
 Is there something I did wrong?
 
 Kind regards,
 
 Remco Poelstra
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.net
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Socket error and socket end

2011-01-11 Thread Remco Poelstra
Hi,

When a socket can't be created in the iOS simulator because of a refused 
connection, I get an end-of-socket event. On the real iPhone I get a general 
socket error event. Is there a reason for this difference? Can I make sure that 
I also receive the end-of-socket event on a real device?

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UITableView with only 1 row selectable

2010-12-24 Thread Remco Poelstra
Hi,

I've an UITableView with allowsSelection=NO; I was wondering whether it's 
possible to do allow selection of a specific row. Is there some way I can 
detect a touch of a row and simulate a select in software?
Thanks in advance.

Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableView with only 1 row selectable

2010-12-24 Thread Remco Poelstra
Hi,

Thanks for your e-mail.
I've considered this, but I think it's ugly that the rows flash blue 
momentarily. Is there a way to avoid that?

Regards,

Remco

Op 24 dec 2010, om 11:01 heeft Roland King het volgende geschreven:

 Why not do it the other way around. Set allowsSelection to YES and then 
 implement the delegate method tableView:willSelectRowAtIndexPath: to return 
 nil for any row you do NOT want selected (see the documentation). That seems 
 to be apple's designed way to do this. 
 
 On 24-Dec-2010, at 5:23 PM, Remco Poelstra wrote:
 
 Hi,
 
 I've an UITableView with allowsSelection=NO; I was wondering whether it's 
 possible to do allow selection of a specific row. Is there some way I can 
 detect a touch of a row and simulate a select in software?
 Thanks in advance.
 
 Regards,
 
 Remco Poelstra
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableView with only 1 row selectable

2010-12-24 Thread Remco Poelstra
Yes, stupid me.

I did search the documentation for a related problem: How can I detect whether 
the will and didAppear methods are called moving upwards or downwards through 
the viewControllers array of a navigationController? I mean I want to detect 
whether a TableViewController is shown because it's pushed on the stack or 
because a higher level TableView is just popped.
Do I need custom logic to track that?

Regards,

Remco

Op 24 dec 2010, om 11:11 heeft Roland King het volgende geschreven:

 again read the documentation - it's all there .. quoting from it .. apple 
 deals with that exact case
 
 This method is not called until users touch a row and then lift their finger; 
 the row isn'€™t selected until then, although it is highlighted on 
 touch-down. You can use UITableViewCellSelectionStyleNone to disable the 
 appearance of the cell highlight on touch-down. This method isn’t called when 
 theediting property of the table is set to YES (that is, the table view is in 
 editing mode).
 
 On 24-Dec-2010, at 6:03 PM, Remco Poelstra wrote:
 
 Hi,
 
 Thanks for your e-mail.
 I've considered this, but I think it's ugly that the rows flash blue 
 momentarily. Is there a way to avoid that?
 
 Regards,
 
 Remco
 
 Op 24 dec 2010, om 11:01 heeft Roland King het volgende geschreven:
 
 Why not do it the other way around. Set allowsSelection to YES and then 
 implement the delegate method tableView:willSelectRowAtIndexPath: to return 
 nil for any row you do NOT want selected (see the documentation). That 
 seems to be apple's designed way to do this. 
 
 On 24-Dec-2010, at 5:23 PM, Remco Poelstra wrote:
 
 Hi,
 
 I've an UITableView with allowsSelection=NO; I was wondering whether it's 
 possible to do allow selection of a specific row. Is there some way I can 
 detect a touch of a row and simulate a select in software?
 Thanks in advance.
 
 Regards,
 
 Remco Poelstra
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org
 
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableView with only 1 row selectable

2010-12-24 Thread Remco Poelstra
Hi,

I'm unable to find that method. Is it still available?

Kind regards,

Remco

Op 24 dec. 2010 om 14:01 heeft Ricky Sharp rsh...@mac.com het volgende 
geschreven:

 
 On Dec 24, 2010, at 4:01 AM, Roland King wrote:
 
 Why not do it the other way around. Set allowsSelection to YES and then 
 implement the delegate method tableView:willSelectRowAtIndexPath: to return 
 nil for any row you do NOT want selected (see the documentation). That seems 
 to be apple's designed way to do this. 
 
 Actually, tableView:shouldSelectRow: should be used instead.  Have it return 
 YES only for rows that are selectable.  I'll also assume that the OP is 
 presenting the non-selectable rows differently (e.g. dimming them) to 
 ensure that users will understand what is selectable and what is not.
 
 On 24-Dec-2010, at 5:23 PM, Remco Poelstra wrote:
 
 Hi,
 
 I've an UITableView with allowsSelection=NO; I was wondering whether it's 
 possible to do allow selection of a specific row. Is there some way I can 
 detect a touch of a row and simulate a select in software?
 Thanks in advance.
 
 ___
 Ricky A. Sharp mailto:rsh...@instantinteractive.com
 Instant Interactive(tm)   http://www.instantinteractive.com
 
 
 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


textFieldShouldEndEditing called multiple times

2010-12-22 Thread Remco Poelstra

Hi,

I've a UITableView with multiple UITextFields.
I implemented textFieldShouldEndEditing for the UITextFields.
When I enter invalid text followed by return, my 
textFieldShouldEndEditing is called once and editing continues.
When I select another UITextField, textFieldShouldEndEditing is called 
multiple times. Why is that?


Thanks in advance.

Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


No TCP connection established after ARP request

2010-12-21 Thread Remco Poelstra

Hi,


I hope this is not too much off topic, but my iPhone app tries to
establish a TCP connection over Wifi.
I noticed that sometimes (about 30% of the attempts), a connection is
refused. I do see an ARP request, but there is no TCP SYN packet
following after the answer. Is this a bug in iOS? How can I make sure
that the ARP request is not needed? Or can I automatically resend the
TCP SYN packet?
Thanks in advance for any ideas.

Kind regards,

Remco Poelstra


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Finding references to object

2010-12-10 Thread Remco Poelstra
Hi,

Instruments tells me that I've a reference to an object, while I believe that 
that reference should no longer exist (and the object be deallocated). How can 
I now find out what objects have references to my should-be-deallocated-object?

Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Problem with NSInputStream

2010-12-07 Thread Remco Poelstra
Hi all,

I've a problem with NSInputStream:
In my object I create (only once) an input and output stream like:

CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault, 
(CFStringRef)IPString, 2101, readStream, writeStream);
if (readStream==NULL || writeStream==NULL ) {
return NO;
}

CFReadStreamSetProperty(readStream, 
kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);
CFWriteStreamSetProperty(writeStream, 
kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);

serialInput=(NSInputStream *)readStream;
serialOutput=(NSOutputStream *)writeStream;

[serialInput setDelegate:self];
[serialOutput setDelegate:self];
[serialInput scheduleInRunLoop:[NSRunLoop currentRunLoop] 
forMode:NSDefaultRunLoopMode];
[serialOutput scheduleInRunLoop:[NSRunLoop currentRunLoop] 
forMode:NSDefaultRunLoopMode];
[serialOutput open];
[serialInput open];

When I'm done with my object, I clean it up (in dealloc) like:
[serialInput  close];
[serialInput release];
[serialOutput  close];
[serialOutput release];

The problem is now that the stream event handler is still called after dealloc 
has finished, resulting in a crash. How can I make sure that the event handler 
is not called anymore? It seems the socket does not get properly closed. Maybe 
a problem with slow handshaking over Wi-Fi?

Any help is appreciated.

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: readonly property which is a mutable array

2010-11-19 Thread Remco Poelstra

Op 19-11-2010 3:51, Ken Thomases schreef:

I of course want the items to be read only for the outside world, but the 
object itself should be able to modify it. Now the compiler complains about the 
properties not matching. How should I solve this? Make a custom getter that 
returns an immutable array? Make the property refer to a mutable array? Make 
the property an immutable array and make copies of the array while modifying it?


The ivar type and the property type don't have to match. In fact, there does 
not need to be any ivar backing whatsoever to properties.

Change your property declaration to NSArray *, and implement the getter with 
[[array copy] autorelease] or similar.


You don't need to implement the getter.  The Cocoa docs are very clear that 
callers must respect the declared type of properties (i.e. return type of 
getters).  That is, if the getter is declared to return an immutable NSArray, 
then callers must not interrogate the returned object to determine if it's 
really mutable nor invoke mutation methods on it.  It may be, and often is 
(even in framework classes), that such a method returns an object that is, in 
fact, an NSMutableArray.  That's an irrelevant implementation detail.


Thanks for the tips. Hope this will kill some warnings :)

Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


readonly property which is a mutable array

2010-11-18 Thread Remco Poelstra
Hi,

I've a object like to following:
@interface Proto {
NSMutableArray *items;
}
@property (nonatomic,readonly) NSMutableArray *items;
@end

I also have a protocol as follows:
@protocol Proto
@property (nonatomic,readonly) NSArray *items;
@end

I of course want the items to be read only for the outside world, but the 
object itself should be able to modify it. Now the compiler complains about the 
properties not matching. How should I solve this? Make a custom getter that 
returns an immutable array? Make the property refer to a mutable array? Make 
the property an immutable array and make copies of the array while modifying it?
Any insight would be appreciated.

Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


valueForKeyPath: not found in protocol

2010-11-16 Thread Remco Poelstra
Hi,

I've somewhat the same problem as a recent thread, but I can't fix it with what 
was suggested in that thread.
I've to following class:
#import Foundation/Foundation.h
#import AudionetCommand.h
#import AudionetQueueDelegateProtocol.h
@interface AudionetCommandQueue : NSObject {
id AudionetQueueDelegate delegate;
}

@property (nonatomic, assign) id AudionetQueueDelegate delegate;
- (void) enqueueCommand:(AudionetCommand *)command;
@end
@implementation AudionetCommandQueue
@synthesize delegate;
- (void) enqueueCommand:(AudionetCommand *)command {
  //Lots of code
  if ([[delegate valueForKeyPath:@audionetDevices.address] isEqual: []]) {};
}
@end

I get the warning that valueForKeyPath: is not found in the protocols. If I 
change the instance variable to id AudionetQueueDelegate,NSKeyValueCoding, I 
get the error that the NSKeyValueCoding protocol can not be found. If I also 
#import NSKeyValueCodingProtocol.h than that header file is not found.
How can I fix this?

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: valueForKeyPath: not found in protocol

2010-11-16 Thread Remco Poelstra
That works indeed. I hoped there was a more elegant solution.

Kind regards,

Remco Poelstra

Op 16 nov 2010, om 11:43 heeft Gideon King het volgende geschreven:

 AFAIK, when something is referenced as a protocol like that, the *only* 
 methods it knows about are the ones in the protocol. If you just cast the 
 delegate to type id, you should be OK (I have encountered similar situations 
 where this solution worked)
 
 [(id)delegate valueForKeyPath:...
 
 HTH
 
 Gideon
 
 On 16/11/2010, at 8:35 PM, Remco Poelstra wrote:
 
 Hi,
 
 I've somewhat the same problem as a recent thread, but I can't fix it with 
 what was suggested in that thread.
 I've to following class:
 #import Foundation/Foundation.h
 #import AudionetCommand.h
 #import AudionetQueueDelegateProtocol.h
 @interface AudionetCommandQueue : NSObject {
  id AudionetQueueDelegate delegate;
 }
 
 @property (nonatomic, assign) id AudionetQueueDelegate delegate;
 - (void) enqueueCommand:(AudionetCommand *)command;
 @end
 @implementation AudionetCommandQueue
 @synthesize delegate;
 - (void) enqueueCommand:(AudionetCommand *)command {
 //Lots of code
 if ([[delegate valueForKeyPath:@audionetDevices.address] isEqual: []]) {};
 }
 @end
 
 I get the warning that valueForKeyPath: is not found in the protocols. If I 
 change the instance variable to id AudionetQueueDelegate,NSKeyValueCoding, 
 I get the error that the NSKeyValueCoding protocol can not be found. If I 
 also #import NSKeyValueCodingProtocol.h than that header file is not found.
 How can I fix this?
 
 Kind regards,
 
 Remco Poelstra
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: valueForKeyPath: not found in protocol

2010-11-16 Thread Remco Poelstra
More elegant indeed :). I thought delegates had to be of type id.

Kind regards,

Remco Poelstra

Op 16 nov 2010, om 11:57 heeft Roland King het volgende geschreven:

 Or use 
 
 NSObject* protocol  
 
 Instead of id. Assuming that all the objects are NSObjects. 
 
 
 
 On Nov 16, 2010, at 18:43, Gideon King gid...@novamind.com wrote:
 
 AFAIK, when something is referenced as a protocol like that, the *only* 
 methods it knows about are the ones in the protocol. If you just cast the 
 delegate to type id, you should be OK (I have encountered similar situations 
 where this solution worked)
 
 [(id)delegate valueForKeyPath:...
 
 HTH
 
 Gideon
 
 On 16/11/2010, at 8:35 PM, Remco Poelstra wrote:
 
 Hi,
 
 I've somewhat the same problem as a recent thread, but I can't fix it with 
 what was suggested in that thread.
 I've to following class:
 #import Foundation/Foundation.h
 #import AudionetCommand.h
 #import AudionetQueueDelegateProtocol.h
 @interface AudionetCommandQueue : NSObject {
   id AudionetQueueDelegate delegate;
 }
 
 @property (nonatomic, assign) id AudionetQueueDelegate delegate;
 - (void) enqueueCommand:(AudionetCommand *)command;
 @end
 @implementation AudionetCommandQueue
 @synthesize delegate;
 - (void) enqueueCommand:(AudionetCommand *)command {
 //Lots of code
 if ([[delegate valueForKeyPath:@audionetDevices.address] isEqual: []]) {};
 }
 @end
 
 I get the warning that valueForKeyPath: is not found in the protocols. If I 
 change the instance variable to id 
 AudionetQueueDelegate,NSKeyValueCoding, I get the error that the 
 NSKeyValueCoding protocol can not be found. If I also #import 
 NSKeyValueCodingProtocol.h than that header file is not found.
 How can I fix this?
 
 Kind regards,
 
 Remco Poelstra
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: valueForKeyPath: not found in protocol

2010-11-16 Thread Remco Poelstra
Op 16 nov 2010, om 12:18 heeft Mark Wright het volgende geschreven:

 Your AudionetQueueDelegate protocol is probably not inheriting from 
 NSObject (the protocol) so it warns that valueForKeyPath: is not found.  
 It'll also probably complain about methods like respondsToSelector: which is 
 also part of the NSObject protocol.
 
 You need to write your protocol declaration in 
 AudionetQueueDelegateProtocol.h as:
 
 
 @protocol AudionetQueueDelegate NSObject
 ...
 @end
 
 
 Then it should silence the warnings and no casting is required (which is not 
 the correct solution in this case I believe).


That does not seem to work.
I now have:
#import UIKit/UIKit.h
@protocol AudionetQueueDelegate NSObject
@end

But then the warning returns. (Having set the delegate to id 
AudionetQueueDelegate again).

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-12 Thread Remco Poelstra

Op 12-11-2010 2:26, Ken Thomases schreef:

On Nov 11, 2010, at 4:57 PM, Graham Cox wrote:


On 12/11/2010, at 3:30 AM, Ken Thomases wrote:


You should not override -setValue:forKey: or -valueForKey: if you can avoid it.  Instead, 
implement the methods -setValue:forUndefinedKey: and -valueForUndefinedKey:.  They are 
precisely for implementing dynamic properties in this manner.


Understood, but the OP's problem as I understand it is that it's not that the 
key is undefined, but the value associated with it is uninitialized. So rather 
than return nil, or zero, he wants to trigger a remote fetch of the value. KVC 
doesn't appear to provide a mechanism for that out of the box.


He was using an NSMutableDictionary for his model, instead of a custom class.  
The barrier to using a custom class was that he has many properties and didn't 
want to implement them all.  The suggestion was to make a class which wraps a 
mutable dictionary and use the KVC methods to provide access to them and also 
serve as the trigger for retrieving those which are not yet cached.

All fine so far.

The suggestion, though, was to implement the wrapper by overriding -setValue:forKey: and 
-valueForKey:.  You shouldn't override those, but rather override 
-setValue:forUndefinedKey: and -valueForUndefinedKey:.  The respective implementations 
would be the same -- they would pass through to the mutable dictionary and initiate 
fetches for absent values.  -setValue:forKey: and -valueForKey: have some special 
powers that you lose if you override them.


I think I don't get it. I now have to following:
@interface PropertiesController: NSObject {
NSMutableDictionary *properties;
}

-valueForKey:
-setValue:forKey:
@end
@implementation PropertiesController
valueForKey  {
id retVal=[properties valueForKey:key];
if (!retVal) {
//fetch value from network
//We do not wait for the value
}
return retVal;
}
@end
If I ommit the valueForKey method, how does the KVC logic now, that it 
should check the properties variable?
Further more, NSDictionary seems to always return a value, so all keys 
are defined, they just return nil sometimes. How can 
valueForUndefinedKey: then ever be called?


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-12 Thread Remco Poelstra

Op 12-11-2010 12:13, Graham Cox schreef:

nil from NSDictionary means no value associated with the key
(dictionaries cannot store 'nil' as a value) so this is your cue to
go fetch. The problem is that the object on which
-valueForUndefinedKey: is invoked is the dictionary, not your
wrapper, and since you are not subclassing the dictionary, you won't
get that message (and the default will simply throw an exception). So
instead, the override to -valueForKey: in your wrapper is acceptable,
in this case. But instead of invoking -valueForKey: on the
dictionary, use -objectForKey: directly. That way, you get nil when
there's no key instead of an exception.


Unfortunatly this does not seem to be true. I use valueForKey on the 
dictionary and for non-existing keys, nil is returned. No exception is 
thrown. This is not a major problem I think, as I can just test for nil 
as with objectForKey.



If you have properties that can legally be nil, you'll need to treat
those differently, using some sort of marker object that means the
property really should return nil (and hence can be stored in a
dictionary). For example [NSNull null] is a valid object which means
'nil'. Basically, you can't use nil itself to mean two different
things, both uninitialized and a legal value, and since NSDictionary
reserves the use of nil to mean undefined, you have no choice but to
deal with that in some way.


Fortunatly, this is not a problem, all my properties are non-nil.


@implementation MyWrapper

- (id)  valueForKey:(NSString*) key { id value = [myDictionary
objectForKey:key];

if( value ) return value;

[self beginFetchForKey:key];// assume starts a thread or
asynchronous task which calls -setValue:forKey: on completion

return nil; // OK, we have no value to return yet. }


- (void) setNilValueForKey:(NSString*) key { [myDictionary
setObject:[NSNull null] forKey:key];// substitute a valid object for
nil values }


Because this does not override -setValue:forKey: you get all the
usual goodness that gives you, such as KVO notifications. As your
thread sets the value using KVC any observers get notified of the
value having been fetched automatically (if you are using a thread
take care to set the value on the main thread so that all
notifications take place on the main thread).


But if I do not override setValue:forKey: How does the KVC logic now 
that it should not try to call setValue:forKey: on my wrapper object, 
but on the enclosed dictionary instead? Do I not need to override 
setValue:forKey: and call [myDictionary setValue:forKey] there? just as 
with valueForKey:?



The override to -valueForKey: here does lose some of the 'special
powers' that Ken alluded to, one of them being the treatment of a
leading '@' in the key. If that matters, you need to emulate what
NSDictionary's implementation does. But since you are really
replacing NSDictionary's version with your own, which has already
discarded the vast majority of NSObject's 'special powers' I can't
see you are losing much in this case. It has the advantage that
subclassing NS(Mutable)Dictionary is not required.


Just out of curiosity, what is the use of the @ operator? I can't find 
anything about it in the KVC Programming Guide.


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-12 Thread Remco Poelstra

Op 12 nov 2010, om 13:37 heeft Graham Cox het volgende geschreven:

 
 On 12/11/2010, at 11:24 PM, Remco Poelstra wrote:
 
 But if I do not override setValue:forKey: How does the KVC logic now that it 
 should not try to call setValue:forKey: on my wrapper object, but on the 
 enclosed dictionary instead? Do I not need to override setValue:forKey: and 
 call [myDictionary setValue:forKey] there? just as with valueForKey:?
 
 My apologies, yes, you do need to do this. Which means you'll also need to 
 implement manual KVO notification using -willChangeValueForKey: and 
 -didChangeValueForKey: since your object's clients will be observing it, not 
 the internal dictionary.

Thanks. I hope overriding these methods will not destroy my performance too 
much.

 
 I'm not sure, but this could create a problem, in that 
 -willChangeValueForKey: MIGHT invoke -valueForKey: in order to cache the old 
 value that is about to be changed so it can pass it in the notification. That 
 will trigger another fetch, because the new value has not yet been set. 
 Result, an infinite cascade of fetches. This is easy to solve using a simple 
 lock flag, but it may not be needed (just be aware of the possibility).

Yes, that happens. Not an endless loop, but every property is indeed requested 
twice, once by me and once by the system.

Kind regards,

Remco Poelstra___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-12 Thread Remco Poelstra


Op 12 nov 2010, om 19:16 heeft Quincey Morris het volgende geschreven:
As as been said several times in this thread, you *shouldn't*  
override 'valueForKey:', but instead override  
'valueForUndefinedKey:' like this:


Is this kind of override ok?:
valueForKey: {
[properties valueForKey:key];
}

Otherwise the valueForKey is called on my wrapper, instead of the  
dictionary that contains the real keys. I don't see how else the KVC  
logic should find out about that instance variable.




@implementation PropertiesController
- (id) valueForUndefinedKey: (NSString*) key {
id retVal=[properties objectForKey:key]; // note: NOT 'valueForKey:'
if (!retVal) {
//fetch value from network
//We do not wait for the value
}
return retVal;
}
@end

If you want to know how control reaches this method, read the  
documentation:


	http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Conceptual/KeyValueCoding/Concepts/SearchImplementation.html%23// 
apple_ref/doc/uid/2955-CJBBBFFA


Unfortunatly, this does not seem to hold for a NSDictionary. It always  
returns something instead of calling valueForUndefinedKey:


Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-12 Thread Remco Poelstra


Op 12 nov 2010, om 20:44 heeft Quincey Morris het volgende geschreven:


In case 2, which seems like the superior solution, the private  
dictionary isn't being accessed via KVC at all, so the only KVC  
behavior you're concerned with is that of the wrapper.


Ah, that explains. If I understand it correctly, for all properties,  
each and everytime, valueForUndefinedKey is called? So I do also need  
to override setValue:forUndefinedKey in case 2? To make sure that the  
properties end up in the dictionary?
Basically it's the same to what I've now (based on the discussion with  
Graham), but adding Undefined to my method names, I do keep the  
performance enhancements of the original implementation?


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-11 Thread Remco Poelstra

Op 10-11-2010 15:31, Quincey Morris schreef:

On Nov 10, 2010, at 06:10, jonat...@mugginsoft.com wrote:


I was just thinking that the overrides would provide a convenient point to 
process all requests for undefined properties.
Depends on the design and requirements of the model I suppose.


I don't think that's happening here -- the property isn't undefined initially, 
it just has an incorrect value initially. :)

The point is, I think, to avoid overriding 'valueForKey:', because of the 
potential horrendous performance problems that could result.


Thanks for all replies. I think I've a problem there. I store all my 
properties in a NSMutableDictionary, so implementing my own getters is 
not possible. I tried overriding valueForKey: by subclassing 
NSMutableDictionary, but soon found out that was not possible as it is a 
cluster.
Leaves me wondering whether I should hardcode all properties (82 items) 
on my own object or try to make a more intelligent subclass of 
NSMutableDictionary. Or maybe a composite object?


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-11 Thread Remco Poelstra

Op 11-11-2010 13:48, Graham Cox schreef:


On 11/11/2010, at 11:41 PM, Remco Poelstra wrote:


Leaves me wondering whether I should hardcode all properties (82 items) on my 
own object or try to make a more intelligent subclass of NSMutableDictionary. 
Or maybe a composite object?



If the requirement is simply to distinguish between an uninitialised value and 
a real value, why not just implement your own object with a method 
-valueForKey: and do whatever you want in there. It could have a 
NSMutableDictionary as a backing store. One method (not 82) and problem solved.

Sounds so simple I'm surely missing something


Seems so :) I just tried that and observing the change of properties is 
now non-functional, as the request for observing is not forwarded to the 
NSDictionary behind my own object. Seems I've to override a whole lot of 
methods to forward them all to the backingstore.


Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Detecting reading a key in KVC

2010-11-11 Thread Remco Poelstra

Op 11-11-2010 14:11, Graham Cox schreef:


On 12/11/2010, at 12:01 AM, Remco Poelstra wrote:


Seems so :) I just tried that and observing the change of properties is now 
non-functional, as the request for observing is not forwarded to the 
NSDictionary behind my own object. Seems I've to override a whole lot of 
methods to forward them all to the backingstore.



You seem to be overthinking this.

Just write a wrapper for -setObject:forKey: and -valueForKey:  The first just 
calls the same method on its (mutable) dictionary, the second can first check 
for whether the value is actually present and if not kick off some task to 
fetch it, or else just get it from the dictionary and return it. You don't need 
to do any general purpose forwarding, unless your object has to look exactly 
like a dictionary externally for some reason, but even then the few methods a 
dictionary implements are still easy to just write wrappers for individually 
rather than doing a general forwarding.

This is an extremely common implementation for caching and I've rarely found it 
more complicated than this.


It might well be that I forgot to implement change notification in my 
wrapper for setObject:forKey: breaking KVO compliance. I'll try that out.


Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Detecting reading a key in KVC

2010-11-10 Thread Remco Poelstra
Hi,

I've an object which properties I access via key-value coding. These properties 
are sometimes uninitialized (that means, the real value needs to be read from 
the Wifi network). I would like to detect a read of such property and then 
fetch it from the network. It's not a problem that in the mean time a wrong 
value is returned. How can I detect a read of a property?

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Joining App Developer Program

2010-11-03 Thread Remco Poelstra

Hi,

I just enrolled into the iOS program and the we are trying to contact  
the legal representative took two weeks. The lady on the phone said  
there was a large queue causing the delay.


Regards,

Remco Poelstra

Op 3 nov 2010, om 00:00 heeft Chris Idou het volgende geschreven:

Sorry if this is a little off topic, but I don't know who to ask and  
I can't get

any sense out of Apple.

I attempted to join the Mac dev program the day Steve Jobs announced  
it. A
couple of days later I was asked to submit some company documents,  
which I did,
and which was acknowledged. Now I've been waiting a week with no  
word, and I'm
eager to start making any necessary changes to my app to support the  
app store.

When I go to the site it says we are trying to contact the legal
representative of your company, which kind of contradicts a  
separate email
which says they are processing my documentation. How long should  
this process
take? When should I get worried? Is there any way to get access to  
technical
documentation without waiting? Is there any way to contact Apple  
since they

don't answer emails?



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/remco%40beryllium.net

This email sent to re...@beryllium.net


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UITableViewCell is not resized in UITableView

2010-10-11 Thread Remco Poelstra


Hi,

I've designed a UITableViewCell in Interface Builder which is 64 points 
heigh.
When I load it into the UITableView, the rows are still there original 
size, so all cells now have overlapping content.

Do I need to specify the new height somewhere?
I load the cell as follows (as per Apple's recommendation):
if (cell == nil) {
[[NSBundle mainBundle] loadNibNamed:@AudionetTableViewCell owner:self 
options:nil];

cell=self.newCell;
self.newCell=nil;
}

Thanks in advance.

Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UITableViewCell is not resized in UITableView

2010-10-11 Thread Remco Poelstra
Then we solved each others problem :) Thanks for solving mine. 

Groetjes,

Remco


Op 11 okt. 2010 om 13:07 heeft Roland King r...@rols.org het volgende 
geschreven:

 
 That all works fine for me. The problem *I* have it getting the UITableView 
 to resize cells horizontally. My tableview is 200px wide, my example cell is 
 something like 800px wide (just because that's how big the template ended up 
 when I was drawing it) and yet once in the tableview it ends up about 380 px 
 wide and I really haven't figured out why. I believe I have all the 
 auto-sizing parameters set up right because it resizes in the vertical just 
 fine. Anyway .. not your question. 
 
 and typically as soon as I post I find the problem, I had the UITableView set 
 up wider than the view containing it, that view was 200px, the UITableView 
 was for some reason 380 .. easily fixed, now the cells do what I expect.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: init returns nil or raises exception?

2010-10-08 Thread Remco Poelstra

Op 7-10-2010 18:12, Jean-Daniel Dupas schreef:


Le 7 oct. 2010 à 18:04, Kyle Sluder a écrit :


On Thu, Oct 7, 2010 at 12:47 AM, Remco Poelstrare...@beryllium.net  wrote:

While still in the process of cleaning up my code, I read in the documentation 
of NSObject that -init should return nil if it fails to initialize. But a 
paragraph lower it's stated that -init should always return a functional 
instance or raise an exception. Isn't that in conflict with the allowance of 
returning nil?


File a documentation bug. I would imagine the paragraph about the
exception is saying that an exception must be raised rather than
returning a half-constructed instance of the object.




I agree. The must raise an exception  is a bug in the documentation IMHO.
There is a lot of recent API that used the 'return nil' pattern (especially 
methods design to return an NSError by ref).


Ah, I see. I hoped it was 'the new way to go'. I like to more than 
checking for nil, but I might be a bit lazy :)

I'll file a bug to get the docs updated.

Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: init returns nil or raises exception?

2010-10-08 Thread Remco Poelstra

Op 8 okt 2010, om 09:57 heeft Kyle Sluder het volgende geschreven:

 On Fri, Oct 8, 2010 at 12:04 AM, Remco Poelstra re...@beryllium.net wrote:
 Ah, I see. I hoped it was 'the new way to go'. I like to more than checking
 for nil, but I might be a bit lazy :)
 
 Checking for nil and assigning to self should be reflexes. You can
 combine the two if you like. Whenever I write an -init method, I
 always follow the same pattern. I don't even need to think about it:
 
 - (id)init {
  if (!(self = [super init]))
return nil;
 
  // do other initialization
 
  return self;
 }
 
 To my brain, it might as well be required syntax.

Yes, but in the rest of my code I've to do the check as well, so this is 
actually not a good thing to do:
[someObject doSomethingWithObject:[CustomClass 
customClassObjectThatMightBeNil]];

Assuming there is also a convenience class method that calls that same init as 
above.

Regards,

Remco Poelstra___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Problem using dictionary

2010-10-08 Thread Remco Poelstra
Hi,

I've the following code:

NSDictionary *dict=[[NSDictionary alloc] initWithContentsOfFile:[[NSBundle 
mainBundle] pathForResource:@Indexes ofType:@plist]]; //This is actually a 
global initialized in +initialize.
NSString *key=[NSString stringWithFormat:@%...@.%@,page,property];
NSLog(@%@,key);
NSLog(@%@,[[dict valueForKey:key] description]);
NSLog(@%@,[[[dict valueForKey:page] valueForKey:property] description]);

The result from the code is:

page1.fwRevCode
(null)
6

The first and last are exactly what I expect. But why can't the dictionary find 
the value with the full key?

Thanks in advance.

Regards,

Remco Poelstra___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem using dictionary

2010-10-08 Thread Remco Poelstra
Ah, I should use valueForKeyPath:. Is there a reason valueForKey: is documented 
directly but valueForKeyPath: is not?

Kind regards,

Remco Poelstra

Op 8 okt 2010, om 13:34 heeft Remco Poelstra het volgende geschreven:

 Hi,
 
 I've the following code:
 
 NSDictionary *dict=[[NSDictionary alloc] initWithContentsOfFile:[[NSBundle 
 mainBundle] pathForResource:@Indexes ofType:@plist]]; //This is actually 
 a global initialized in +initialize.
 NSString *key=[NSString stringWithFormat:@%...@.%@,page,property];
 NSLog(@%@,key);
 NSLog(@%@,[[dict valueForKey:key] description]);
 NSLog(@%@,[[[dict valueForKey:page] valueForKey:property]   description]);
 
 The result from the code is:
 
 page1.fwRevCode
 (null)
 6
 
 The first and last are exactly what I expect. But why can't the dictionary 
 find the value with the full key?
 
 Thanks in advance.
 
 Regards,
 
 Remco Poelstra___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/remco%40beryllium.net
 
 This email sent to re...@beryllium.net

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem using dictionary

2010-10-08 Thread Remco Poelstra

Op 8 okt 2010, om 20:34 heeft Quincey Morris het volgende geschreven:


On Oct 8, 2010, at 04:47, Remco Poelstra wrote:

Is there a reason valueForKey: is documented directly but  
valueForKeyPath: is not?


They're both documented, but it requires familiarity with how to  
read the Cocoa documentation, which is an important point that goes  
beyond just this example.


The methods are documented as part of the NSKeyValueCoding protocol  
here:


	http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/Reference/ 
Reference.html


It's briefly mentioned, in that document and slightly more  
definitively in:


	http://developer.apple.com/library/mac/#documentation/Cocoa/ 
Conceptual/KeyValueCoding/Concepts/Overview.html


that there's a default implementation of NSKeyValueCoding in  
NSObject. NSDictionary inherits this behavior from NSObject, but  
because the default 'valueForKeyPath:' is documented as operating in  
terms of 'valueForKey:', NSDictionary only needs to override the  
latter, and its own documentation only needs to document the override.


That seems reasonable, but makes the documentation harder to read. In  
the old days where I used Delphi, the inherited methods were all shown  
as such and it gives a direct overview of what is available.  
Especially in this case, where the valueForKey* methods are neither  
mentioned in the NSObject docs, not that NSObject  
followsNSKeyValueCoding. Well, maybe Apple adds such functionality  
someday to their doc browser.


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


init returns nil or raises exception?

2010-10-07 Thread Remco Poelstra
Hi,

While still in the process of cleaning up my code, I read in the documentation 
of NSObject that -init should return nil if it fails to initialize. But a 
paragraph lower it's stated that -init should always return a functional 
instance or raise an exception. Isn't that in conflict with the allowance of 
returning nil?
Thanks in advance.

Regards,

Remco Poelstra___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Checking for nil-return

2010-10-05 Thread Remco Poelstra

Hi,

I'm cleaning up my code and I'm wondering about constructs like the next 
one:

[NSNumber numberWithUnsignedChar:i]
The documentation does not say it can return nil on failure, but does 
that mean it simply will never fail? What if there is no memory left?


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Checking for nil-return

2010-10-05 Thread Remco Poelstra

Op 5-10-2010 16:11, Dave DeLong schreef:

Then you have much bigger problems.


I already thought so :). But I noticed that [NSArray arrayWithCapacity] 
also never returns nil. But I can create a very large array, and I can 
make it bigger with addObjects:atIndexes: and that function returns 
void, so always succeeds. How is that possible?


Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Checking for nil-return

2010-10-05 Thread Remco Poelstra

Op 5-10-2010 16:23, Matt Gough schreef:


On 5 Oct 2010, at 15:18:06, Remco Poelstra wrote:


Op 5-10-2010 16:11, Dave DeLong schreef:

Then you have much bigger problems.


I already thought so :). But I noticed that [NSArray arrayWithCapacity] also 
never returns nil. But I can create a very large array, and I can make it 
bigger with addObjects:atIndexes: and that function returns void, so always 
succeeds. How is that possible?



Because it throws exceptions if anything bad happens at runtime (i.e out of 
memory, invalid parameters etc)

Google for NSException


Ah, I see. I thought exceptions were meant for programming errors.
This definitely helps in make sure my code behaves nice.

Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Property list file with NSNumber objects as keys

2010-10-04 Thread Remco Poelstra
Hi,

In the NSDictionary documentation it is stated that NSNumber objects are valid 
property list objects.
But when I create a dictionary with NSNumbers as keys, writeToFile: fails. If I 
use strings, then it succeeds. Is it possible to use NSNumbers as keys and have 
the, read/written from/to file?
Thanks in advance.

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Property list file with NSNumber objects as keys

2010-10-04 Thread Remco Poelstra

Op 4-10-2010 14:55, Roland King schreef:

http://developer.apple.com/library/mac/#documentation/cocoa/Conceptual/PropertyLists/AboutPropertyLists/AboutPropertyLists.html%23//apple_ref/doc/uid/1048i-CH3-46719-CJBIGFCD

No. writeToFile: writes a property list representation of the dictionary and 
from the above you can see that NSDictionary must have String keys to be a 
property list.

You could turn it into NSData and write it like that perhaps.


Thanks for your reply.
I don't see why it have to be strings, just because it will be an XML 
file, but if it's not possible than that's OK for me. I just hoped that 
using NSNumber would make it faster (to look up), since it requires less 
conversions.


Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Changing classes

2010-10-01 Thread Remco Poelstra

Op 30-9-2010 21:58, Quincey Morris schreef:

It's not at all obvious that having your class(es) represent your
hardware is the right way to approach this.

What are you actually trying to achieve? If the various kinds of
hardware are differentiated by their properties, then a single
class encapsulating the possible properties (including a
specification of which properties are actually present for each
device) may be all that you need.

You would only use a class hierarchy if the class has significant
shared *behavior*, plus behavior that is specific to each device
type. Note that I'm talking about class behavior, not device
behavior. The device behavior isn't relevant to the class behavior,
unless the class is a software simulation of the device.


Hi,

Thanks for all answers! Seems there are a lot of possibilities solving 
such a simple thing :)


I'm representing network enabled amplifiers, some of which have multiple 
inputs, some not. Other have surveillance features build in, which 
others might not have.
I'm not trying to simulate them, just representing them so I can 
communicate with them.
I think I do not fully understand the difference you are trying to make 
between device and class behaviour. The amplifiers do a lot the same, 
but some responses might need another interpretation. In the end, all 
communication is over a standard protocol for all amplifiers and I want 
the UITableview on my iPhone to show more or less (depending on 
capabilities of course) the same layout.


Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Changing classes

2010-09-30 Thread Remco Poelstra
Hi,

I've a class that represents a general piece of hardware. Subclasses of that 
class represent more specific versions of that hardware. When I scan the 
network for hardware, I first only know some basic properties of the hardware 
and only after some more queries I'll know all details. I thought it would be a 
good thing to instantiate from the base class when I detect the hardware and 
then change the class to a more specific class as I find out more about the 
hardware.
But how do I change a class? I know about the ISA pointer, but changing it 
doesn't allocate any additional variables.
What would be a nice solution to this problem?
 
Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Settings button in UITableView

2010-09-24 Thread Remco Poelstra

Hi,

I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
The table shows devices that the app has found on the Wifi network. When 
I click on a row I show a detailview of the device. This all works fine.
The device has some internal configuration settings that the user needs 
to be able to change (like whether the device uses DHCP for its IP 
address). In order to let the user change these settings I've added a 
settings button to my UIToolbar. When the user taps the button I want 
to show a button for each row which allows the user to enter the 
configuration view. Much like the Delete button in the e-mail app.
I've found out that I can change the text of the default Delete 
button, but how can I show that button without putting the UITableView 
in edit mode and requiring the user to tap the delete circle (on the 
left) first?

Or can I add such a button on the fly to all rows?

Thanks in advance.

Kind regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Settings button in UITableView

2010-09-24 Thread Remco Poelstra
Hi,

Interesting point, I've been thinking about that as well. The problem is that I 
think it's confusing for the user. In the wifi settings pane, the user either 
selects the row or goes to a detail view. In my case the user goes to a 
tableview when he selects the row, but the disclosure button will give a 
(modal) detail view, so the responses are quite the same. Wouldn't that confuse 
them?

Regards,

Remco Poelstra

Op 24 sep. 2010 om 17:19 heeft Conrad Shultz con...@synthetiqsolutions.com 
het volgende geschreven:

 Hi Remco,
 
 I haven't done what you're asking so I don't have the sort of ready answer 
 others on the list probably do, but I would ask why you don't use a detail 
 disclosure button (i.e. the right arrow inside a blue circle) in each table 
 cell for this purpose. UITableView very much supports this motif (tap the 
 cell contents for one set of details, tap the accessory for another) and 
 users will be familiar with the paradigm (e.g. in WiFi settings). 
 
 It also saves users a tap, and minimizes the hiding of functionality.  
 
 Conrad Shultz
 www.synthetiqsolutions.com
 
 On Sep 24, 2010, at 1:33, Remco Poelstra re...@beryllium.net wrote:
 
 Hi,
 
 I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
 The table shows devices that the app has found on the Wifi network. When I 
 click on a row I show a detailview of the device. This all works fine.
 The device has some internal configuration settings that the user needs to 
 be able to change (like whether the device uses DHCP for its IP address). In 
 order to let the user change these settings I've added a settings button 
 to my UIToolbar. When the user taps the button I want to show a button for 
 each row which allows the user to enter the configuration view. Much like 
 the Delete button in the e-mail app.
 I've found out that I can change the text of the default Delete button, 
 but how can I show that button without putting the UITableView in edit mode 
 and requiring the user to tap the delete circle (on the left) first?
 Or can I add such a button on the fly to all rows?
 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Settings button in UITableView

2010-09-24 Thread Remco Poelstra
Op 24 sep. 2010 om 17:15 heeft Matt Neuburg m...@tidbits.com het volgende 
geschreven:

 On Fri, 24 Sep 2010 10:33:28 +0200, Remco Poelstra re...@beryllium.net
 said:
 Hi,
 
 I've a UITableView with UITableViewCell of style UITableViewStyleSubtitle.
 The table shows devices that the app has found on the Wifi network. When
 I click on a row I show a detailview of the device. This all works fine.
 The device has some internal configuration settings that the user needs
 to be able to change (like whether the device uses DHCP for its IP
 address). In order to let the user change these settings I've added a
 settings button to my UIToolbar. When the user taps the button I want
 to show a button for each row which allows the user to enter the
 configuration view. Much like the Delete button in the e-mail app.
 I've found out that I can change the text of the default Delete
 button, but how can I show that button without putting the UITableView
 in edit mode and requiring the user to tap the delete circle (on the
 left) first?
 Or can I add such a button on the fly to all rows?
 
 Sure, just use a custom table view cell and you can make each cell show
 anything you want. What I would do is always have the button be there, and
 just show or hide it when I provide the cell, according to some state
 variable. Call reload data to ask Cocoa to ask you to provide cells again.
 

Hi,

Is there some precaution I've to take to make sure the buttons slide in nicely 
like they do in the mail app? I've currently no idea about coding animations 
and such.

Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Generating variable frequency tones

2010-09-10 Thread Remco Poelstra

Op 9 sep 2010, om 21:58 heeft Remco Poelstra het volgende geschreven:
 I'm looking for some way to generate a tone that resembles the sound of an 
 instrument. I need precise control of the base frequency (pitch). I'm 
 wondering what would be the best way to generate it on an iPhone.
 Store a file with a know frequency and resample it to the desired frequency? 
 Synthesize a tone by calculating a bunch of sines? Doing some FFT trick on a 
 file?
 If someone can give some insight into what would best fit the H/W available 
 it would be grateful.

Hi,

Thanks for all replies. Given the answers, it had less to do with Cocoa than I 
thought, or can be solved perfectly in a non-Cocoa specific way on the iPhone. 
Seems that Core Audio will be the way to go.

Regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: First trials in Cocoa app

2010-09-09 Thread Remco Poelstra

Op 9-9-2010 6:52, Dave Carrigan schreef:

No, I missed that part about his VC being stored in the app delegate. So, yeah, 
if he isn't able to pass context to the C library, he can easily get to the VC 
in that way rather than resorting to a global.


Hi,

Thanks for the replies. I never expected it to be difficult, but there 
is so much information to process at the moment, that I'm about to miss 
some details here and there. Thanks for pointing them out.


Regards,

Remco Poelstra
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Generating variable frequency tones

2010-09-09 Thread Remco Poelstra

Hi,

I'm looking for some way to generate a tone that resembles the sound  
of an instrument. I need precise control of the base frequency  
(pitch). I'm wondering what would be the best way to generate it on an  
iPhone.
Store a file with a know frequency and resample it to the desired  
frequency? Synthesize a tone by calculating a bunch of sines? Doing  
some FFT trick on a file?
If someone can give some insight into what would best fit the H/W  
available it would be grateful.


Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


First trials in Cocoa app

2010-09-08 Thread Remco Poelstra
Hi all,

I'm very new to Cocoa and I'm trying to build my first app after reading and 
doing tutorials.
I've a view with a UITextView on it and a button. When I press the button I 
want to call a third party C library which sends out and UDP packet searching 
for devices on the network. The responses of the devices are reported back with 
a callback that I've to supply.
In the callback I want to store the string information in a NSMutableString and 
then update the UITextView with that string.
I've a few problems: How can I pass a method from an object to the C library as 
callback? I'm currently using the NSViewController to define the 
method/callback.
If that's not possible, how can I define a function that can reach the objects 
of my application? The ViewController is stored in the ApplicationDeletegate, 
but I can't find any reference to that object.
I've defined the NSMutableString as a global in the viewcontroller header file, 
is that a good idea given the MVC design pattern?
Hope someone can get me started on this one.

Kind regards,

Remco Poelstra

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com