Re: NSTableView: which delegate after a drag operation?

2011-03-05 Thread Ulf Dunkel

Hi Scott.


1) Which delegate can I use to inform table view B to update and reload its 
data when I have dragged an item inside table view A?


If you’re adding it to the object array, you can easily do the update 
notification then.


[..] what do you mean here with "the object array”?


If you’re adding the dragged data to your target table, that’s a good time to 
provide some notification that it needs to be updated.


I only allow rows in NSTableView A to be moved inside A, or rows in 
NSTableView B to be moved inside B. But when a row in A has been moved, 
I want B to load and show updated data.


I really don't know which notification or delegate to use for this.

Can you give me a notification example, please?

---Ulf Dunkel

___

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: Accepting current edited text field contents

2011-03-05 Thread Jonathan Taylor
Thanks again for your help, and thanks in particular for your follow-up email, 
which was a great help in working out the bindings (it was indeed the first 
time I'd done anything like that!). I have a couple of follow-up questions if 
you don't mind.

Question 1 - you state "Nothing in any of this will or should have any effect 
on what's selected in the text field where editing was in progress", but if we 
are both talking about the same thing then I don't think that's happening for 
me. The screenshots before and after clicking the "send" button (which triggers 
a commit) are shown here:
www.dur.ac.uk/j.m.taylor/before_send.png
www.dur.ac.uk/j.m.taylor/after_send.png
The text field has lost focus. Would you expect this to happen? Does this 
suggest that I've slipped up somewhere in how I have wired everything up 
together or something?

Question 2 - the method you have described seems to be very much tied to a 
single NSObjectController for the entire window, and indeed IB just seems to 
offer the option to bind to "Object Controller", without specifying "which 
one". In that case, is there any way of achieving neat group-based behaviour 
for the following window?
www.dur.ac.uk/j.m.taylor/grouped.png
Here there are two separate categories of editable fields. If "send" is clicked 
then it is important that any edits to the stage command field are committed, 
but I think it would make more sense if ongoing edits to the "stage limits" 
fields are NOT committed if "send" is clicked (they are completely irrelevant). 
n.b. the window does not close when "send" is clicked. Is there any way of 
achieving this?

Cheers
Jonny___

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: Accepting current edited text field contents

2011-03-05 Thread Jonathan Taylor
> Question 2 - the method you have described seems to be very much tied to a 
> single NSObjectController for the entire window, and indeed IB just seems to 
> offer the option to bind to "Object Controller", without specifying "which 
> one". In that case, is there any way of achieving neat group-based behaviour 
> for the following window?
>   www.dur.ac.uk/j.m.taylor/grouped.png
> Here there are two separate categories of editable fields. If "send" is 
> clicked then it is important that any edits to the stage command field are 
> committed, but I think it would make more sense if ongoing edits to the 
> "stage limits" fields are NOT committed if "send" is clicked (they are 
> completely irrelevant). n.b. the window does not close when "send" is 
> clicked. Is there any way of achieving this?

OK, I've worked out the simple answer to my question 2 - you can create more 
than one object controller and change their names in the Identity inspector. IB 
then lets you choose which one to bind 
to.___

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


binding relationship to checkbox

2011-03-05 Thread Amy Heavey

Hi Everyone,

I was wondering if anyone could point me in the right direction for my  
problem?


I'm working on a core data application, and in this issue I have 2  
entities, product and category. They have a many to many relationship.


In my interface I want to have a list of all the categories with a  
checkbox column, so the checkboxes indicate if there is a relationship  
between the selected product and the category. It's along the lines of  
keywords in iPhoto, so I can set/unset the relationships using the  
checkboxes?


This sounds to me like something that should be doable with the  
'magic' of bindings, but I can't see how to do this?


I do appreciate any help anyone can offer me,

Many Thanks

Amy

___

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: Accepting current edited text field contents

2011-03-05 Thread jonat...@mugginsoft.com

On 5 Mar 2011, at 14:05, Jonathan Taylor wrote:

> Thanks again for your help, and thanks in particular for your follow-up 
> email, which was a great help in working out the bindings (it was indeed the 
> first time I'd done anything like that!). I have a couple of follow-up 
> questions if you don't mind.
> 
> Question 1 - you state "Nothing in any of this will or should have any effect 
> on what's selected in the text field where editing was in progress", but if 
> we are both talking about the same thing then I don't think that's happening 
> for me. The screenshots before and after clicking the "send" button (which 
> triggers a commit) are shown here:
>   www.dur.ac.uk/j.m.taylor/before_send.png
>   www.dur.ac.uk/j.m.taylor/after_send.png
> The text field has lost focus. Would you expect this to happen? Does this 
> suggest that I've slipped up somewhere in how I have wired everything up 
> together or something?
> 
This is normal. To say that the text field has lost focus is missing the point. 
It is no longer the first responder and therefore no longer displays the focus 
rect. Searching the docs for "focus" won't help. firstResponder will.

> Here there are two separate categories of editable fields. If "send" is 
> clicked then it is important that any edits to the stage command field are 
> committed, but I think it would make more sense if ongoing edits to the 
> "stage limits" fields are NOT committed if "send" is clicked (they are 
> completely irrelevant). n.b. the window does not close when "send" is 
> clicked. Is there any way of achieving this?
> 

This sounds confusing. Anyhow, its totally up to you whether a pending edit is 
committed or not. EIther do or don't send commitEditing to the controller 
dependent on which object is first responder.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.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


NSImageView mouseUp problem?

2011-03-05 Thread Alexander Zvyagin
Hi, All!


I has a custom view must show the mouseEntered state and mousePressed state in 
different pictures.
If mouse press is inside this view but mouse release is outside, my view 
doesn't receive -mouseUp event:


--- cut ---
>>> press is really there <<<
// [-mouseDown] { 360 x 126} NSImageView
// [-mouseDown] { 361 x 195} NSImageView
// [-mouseDown] {  52 x  55} MyCustomView
>>> release is really there <<<
// [-mouseUp] { 260 x 117} NSImageView
// [-mouseUp] { 261 x 186} NSImageView
// !!! no -mouseUp event for MyCustomView there
--- cut ---



This was a log from:



@implementation NSControl( mouseEvents )

-( void )mouseDown:( NSEvent* )theEvent
{
NSPoint thePoint = [self convertPoint:[theEvent locationInWindow] 
fromView:[self superview]];
NSLog( @"[-mouseDown] {%4g x%4g} %@", thePoint.x, thePoint.y, [self className] 
);
[super mouseDown:theEvent];
}

-( void )mouseUp:( NSEvent* )theEvent
{
NSPoint thePoint = [self convertPoint:[theEvent locationInWindow] 
fromView:[self superview]];
NSLog( @"[-mouseUp] {%4g x%4g} %@", thePoint.x, thePoint.y, [self className] );
[super mouseUp:theEvent];
}

@end


What can I do to receive this -mouseUp event ?
Or did NSImageView doesn't resend -mouseUp to over responders?


Alex.

___

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: Accepting current edited text field contents

2011-03-05 Thread Quincey Morris
On Mar 5, 2011, at 06:05, Jonathan Taylor wrote:

> Question 1 - you state "Nothing in any of this will or should have any effect 
> on what's selected in the text field where editing was in progress", but if 
> we are both talking about the same thing then I don't think that's happening 
> for me. The screenshots before and after clicking the "send" button (which 
> triggers a commit) are shown here:
>   www.dur.ac.uk/j.m.taylor/before_send.png
>   www.dur.ac.uk/j.m.taylor/after_send.png
> The text field has lost focus. Would you expect this to happen? Does this 
> suggest that I've slipped up somewhere in how I have wired everything up 
> together or something?

It's quite possible I was wrong on this, but it's kind of hard to know where 
the behavior is coming from. However, it wouldn't be hard to save and restore 
the current selection around your 'commitEditing' invocation, if that's the 
behavior you want. Possibly there's a more direct way I'm not thinking of at 
the moment.

> Question 2 - the method you have described seems to be very much tied to a 
> single NSObjectController for the entire window, and indeed IB just seems to 
> offer the option to bind to "Object Controller", without specifying "which 
> one". In that case, is there any way of achieving neat group-based behaviour 
> for the following window?
>   www.dur.ac.uk/j.m.taylor/grouped.png
> Here there are two separate categories of editable fields. If "send" is 
> clicked then it is important that any edits to the stage command field are 
> committed, but I think it would make more sense if ongoing edits to the 
> "stage limits" fields are NOT committed if "send" is clicked (they are 
> completely irrelevant). n.b. the window does not close when "send" is 
> clicked. Is there any way of achieving this?

What does "not committed" mean to the user? Nothing, I think. The whole purpose 
of the NSEditor protocol is to *eliminate* the distinction in the user's mind 
-- to ensure that the One True value of each text field is the value the user 
sees.

If the text field changes are individually undoable, the whole question is a 
bit more subtle. If you have uncommitted changes in, say, the Lower X field, 
then undo actually says Undo Typing (and individual text field edits are 
undoable). After a commit of the text field, undo would say Undo Lower X, and 
if this happened because you clicked Send, then undo would (presumably) say 
Undo Send, and the *previous* undo action would be Undo Lower X. Whatever 
functionality you want, you're going to have to code carefully to implement.

___

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: NSImageView mouseUp problem?

2011-03-05 Thread Alexander Zvyagin
> What can I do to receive this -mouseUp event [losted by NSImageView] ?

 -mouseUp is coming only custom view is LOWER any existing NSImageView inside 
Interface Builder xib document (Mac OS X 10.6.6).

I think this mean NSImageView doesn't send -mouseUp to next responder.

Is this a bug?

* Note the NSImageView has no Core Animation checkbox enabled (inside Interface 
Builder inspector panes), but custom view use [-setWantsLayer:YES].

___

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: animating addSubview with iOS4

2011-03-05 Thread Matt Neuburg
On Fri, 04 Mar 2011 14:30:12 +0100, Andreas Grosam  said:

>So it seems, there is a problem performing UIViewAnimationOptionTransition... 
>animations for the UIView transitionWithView:... class method, and possibly 
>for transitionFromView:... invoked from -viewWillAppear: and viewDidAppear:.

My first thought is to wonder whether this is related to the problem I often 
see where the *first* curl animation I ask for in an app is often not 
performed, no matter how or when it's triggered. I have tried to work around 
this by "priming the pump" (performing some harmless animation that wakes up 
the animation world) but not with any great degree of success.

For example, my Zotz! app deals cards like this:

- (void) setCardWithAnimation: (Card*) newCard {
  [UIView beginAnimations:nil context:nil];
  [UIView setAnimationDuration: 0.35];
  [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:self 
cache:YES];
  self.card = newCard;
  [self setNeedsDisplay];
  [UIView commitAnimations];
}

In a completely new game from a cold start, this doesn't work reliably for the 
*first* trio of replacement cards. All three replacement cards just appear, 
bang, without any animation. But this is not at the start of the game; the app 
has been running for some time, and there have been other animations that have 
appeared correctly. So perhaps it's no coincidence that this example has to do 
with a curl animation, and perhaps what you're observing is this, and has 
nothing to do with viewDidAppear: per se.

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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: Outlets Not Connected In awakeFromNib

2011-03-05 Thread Matt Neuburg
On Fri, 04 Mar 2011 10:21:38 +0100, Andreas Grosam  said:
>All,
>
>thank you for your replies. It made me re-read the Resource Programming Guide. 
>And it works exactly as it is described (except that the description for 
>-awakeFromNib in the Reference could be more accurate). Though, I have mixed 
>feelings about how it works.
>
>Unfortunately, due to the problem described previously, -awakeFromNib does not 
>seem to be always appropriate for its intended use as described in the 
>reference. There are also subtle differences between iOS and Mac OS.
>
>On iOS, when using -viewDidLoad, we need to consider that it can possibly be 
>called more than once in the life cycle for a controller, and may be created 
>from within a nib or programmatically. This often requires extra care in this 
>and possibly related methods, e.g. -viewDidUnload. So, unfortunately, there is 
>no easier way.

I'm not grasping where there can be any source of confusion here. awakeFromNib 
is very simple: it is sent to an object after that object is instantiated from 
a nib. That's straightforward and dependable and clear - provided you know what 
a nib is, of course. The only "subtle difference" between Mac OS X and iOS in 
this regard is that in iOS you are enjoined to call super in your 
implementation. (There are some memory management differences for objects 
instantiation from nibs between Mac OS X and iOS, but that's a different 
matter.)

What you say about viewDidLoad is perfectly true, but should not be an issue 
provided you do in viewDidLoad only things that are suitable for viewDidLoad 
(i.e. things that can do no harm if done more than once).

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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: Accepting current edited text field contents

2011-03-05 Thread Jonathan Taylor
>> Question 2 - the method you have described seems to be very much tied to a 
>> single NSObjectController for the entire window, and indeed IB just seems to 
>> offer the option to bind to "Object Controller", without specifying "which 
>> one". In that case, is there any way of achieving neat group-based behaviour 
>> for the following window?
>>  www.dur.ac.uk/j.m.taylor/grouped.png
>> Here there are two separate categories of editable fields. If "send" is 
>> clicked then it is important that any edits to the stage command field are 
>> committed, but I think it would make more sense if ongoing edits to the 
>> "stage limits" fields are NOT committed if "send" is clicked (they are 
>> completely irrelevant). n.b. the window does not close when "send" is 
>> clicked. Is there any way of achieving this?
> 
> What does "not committed" mean to the user? Nothing, I think. The whole 
> purpose of the NSEditor protocol is to *eliminate* the distinction in the 
> user's mind -- to ensure that the One True value of each text field is the 
> value the user sees.
I think I see what you're saying, but my motivation was based on a similar 
philosophy I think: if the user has accidentally typed something non-numerical 
into the "lower x" field, I was thinking they would be rather surprised if 
clicking on "send" caused the GUI to suddenly start complaining about "lower x" 
not being valid and refusing to send raw stage commands until that unrelated 
issue was rectified.

> If the text field changes are individually undoable, the whole question is a 
> bit more subtle. If you have uncommitted changes in, say, the Lower X field, 
> then undo actually says Undo Typing (and individual text field edits are 
> undoable). After a commit of the text field, undo would say Undo Lower X, and 
> if this happened because you clicked Send, then undo would (presumably) say 
> Undo Send, and the *previous* undo action would be Undo Lower X. Whatever 
> functionality you want, you're going to have to code carefully to implement.
Fortunately I'm not even going to consider Undo in this situation. These 
commands have actual real-world consequences in terms of motor movement, so the 
GUI-based concept of Undo does not really 
apply.___

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: Setting a delegate on a UITextField

2011-03-05 Thread Matt Neuburg
On Thu, 03 Mar 2011 18:51:39 -0800 (PST), Dianne 
 said:
>there is, you need to use a formatter for that, you can even set the allowed 
>characters to be inputted to the textfield.
>check NSFormatter if it is of any help, you can also extend the class to 
>adjust 
>to your needs.
>
>From: Jon Sigman 
>To: Cocoa Developers 
>Sent: Fri, March 4, 2011 10:29:23 AM
>Subject: Re: Setting a delegate on a UITextField
>
>Okay, part II:
>
>Is there a way to allow only a certain number of characters in a UITextField? 
>Should this be done in the -textFieldDidEndEditing delegate callback, with an 
>alert to the user, or just truncating the field, or ...?
>

But that's not such a good answer for iOS (this is a UITextField, not an 
NSTextField) because you can't attach a formatter to a text field there. It's a 
pity, but there it is. You're going to have to make a design decision and it 
isn't going to be pleasant. :(

One possible approach on iOS is to implement textFieldShouldEndEditing, and 
return NO and put up an alert if there's a problem. Another is just to make the 
change yourself in textFieldDidEndEditing. See the section entitled "Validating 
Entered Text" (along with the preceding section) in the "Managing Text Fields 
and Text Views" chapter of the Text, Web, and Editing Programming Guide for iOS.

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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: Accepting current edited text field contents

2011-03-05 Thread Quincey Morris
On Mar 5, 2011, at 11:03, Jonathan Taylor wrote:

> I think I see what you're saying, but my motivation was based on a similar 
> philosophy I think: if the user has accidentally typed something 
> non-numerical into the "lower x" field, I was thinking they would be rather 
> surprised if clicking on "send" caused the GUI to suddenly start complaining 
> about "lower x" not being valid and refusing to send raw stage commands until 
> that unrelated issue was rectified.

Your point is valid too. :)

I think you need to make a distinction between validation time (which happens 
when the Send button is pressed) and commit time (which has to have happened 
before validation time, immediately before if not sometime earlier). Therefore, 
pressing the button should cause 'commitEditing' to be invoked for at least the 
text fields the action depends on, so that validation of those fields uses the 
correct values -- as will the action itself. That's what you've got now.

What you're also doing now (or proposing to do now) is using the UI text fields 
that are *not* related to the Send button as ad-hoc temporary storage for 
unvalidated values. That's why you're trying to prevent them from being 
committed "too early". As you've seen, this is terribly fragile, because your 
app is not necessarily in full control of the field editor state. You could 
code around this fragility and hope for the best (which would probably be 
pretty good, if you use an object controller per text field group), or you 
could let go of the requirement that's causing the trouble.

It doesn't seem necessary to require that text fields should not get committed 
at other times. That is, you don't want to validate text fields at commit time, 
but at action time. (Sometimes the same thing, but not always.) Once you let go 
of that, things get much easier as far as the field editor state is concerned.

There may actually be extra work with this approach, though. If your data model 
can't tolerate invalid values being committed (such as the non-numerical "lower 
x" field), you may have to bind the UI text fields to intermediate properties 
in your window controller (real temporary storage for unvalidated values), and 
have your validation code transfer the validated values to the data model when 
needed. But that doesn't sound necessary in your case -- you've basically said 
that nothing cares what "lower x" is until the time comes to use it.

It's possible, perhaps even likely, that I'm over-thinking this, but I've found 
in the past that putting text fields in a main window like this, especially 
when the values are intended to be "picked up" by a button press, is an 
extremely subtle UI problem, one that's very hard to get right. It's actually 
better *not* to use naked text fields**, and to use something like a sheet to 
enter the values, but it sounds like that's too inconvenient in your 
application.

FWIW


** It's an interesting exercise to go through your Applications folder and see 
if you can find *any* app that has naked text fields in a main window. You'll 
find some search fields in toolbars, and you'll find some text fields in 
floating/inspector windows, but you'll be lucky to find any apps that solve the 
UI problem you're dealing with here.


___

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: XML Namespace Definitions on Non-Root Elements

2011-03-05 Thread Matt Neuburg
On Fri, 04 Mar 2011 14:25:06 -0600, Heath Borders  
said:
>I'm trying to parse a document with a namespace declared on a non-root element:
>
>http://example.com/foo";>This is an
>exemplary foo!
>
>I can read this xml into an NSXMLDocument just fine, but the following
>XPath query on root returns a non-nil, but empty NSArray:
>
>NSXMLNode *rootNode = ...// create my root node somehow
>NSArray *exampleFooElements = [rootNode
>nodesForXPath:@"/root/example:foo" error:nil];
>// exampleFooElements != nil && [exampleFooElements count] == 0
>
>However, if I add the namespace declaration to the root element,
>everything is fine:
>
>http://example.com/foo";>This is an
>exemplary foo!
>
>NSXMLNode *rootNode = ...// create my root node somehow
>NSArray *exampleFooElements = [rootNode
>nodesForXPath:@"/root/example:foo" error:nil];
>// exampleFooElements != nil && [exampleFooElements count] == 1
>
>I can do this change programmatically, but I'd rather not have to
>modify the document.  This namespace usage should be legal.  Am I
>doing something wrong?

It's no use just saying "example:"; you have to have a way to tell it what 
"example:" *is* - i.e. you have to bind the namespace - and you don't have a 
way to do that from here. One option is to bypass the namespace altogether:

  nodesForXPath:@"//*[local-name()='foo']"

m.


--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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: Outlets Not Connected In awakeFromNib

2011-03-05 Thread Carlos Eduardo Mello


On Mar 5, 2011, at 4:00 PM, Matt Neuburg wrote:

I'm not grasping where there can be any source of confusion here.  
awakeFromNib is very simple: it is sent to an object after that  
object is instantiated from a nib. That's straightforward and  
dependable and clear - provided you know what a nib is, of course.  
The only "subtle difference" between Mac OS X and iOS in this regard  
is that in iOS you are enjoined to call super in your  
implementation. (There are some memory management differences for  
objects instantiation from nibs between Mac OS X and iOS, but that's  
a different matter.)


What you say about viewDidLoad is perfectly true, but should not be  
an issue provided you do in viewDidLoad only things that are  
suitable for viewDidLoad (i.e. things that can do no harm if done  
more than once)


I am pretty knew to cocoa and everything, and agree that  awakeFromNib  
seems pretty straight forward, but I accidentally came across one of  
those double calls and found out something interesting: in a document  
template-based app, I connected a custom view to an outlet in my  
document class in order to setup it up  and use it. Then I  
coincidentaly named a method in my document class as a setter to that  
outlet. Apparently that triggered the window controler (or some other  
part of the document architecture) to call awakeFromNib while my  
outlet was still nil (note that several other outlets in the same  
window were already instantiated...). I tested it many times and as  
soon as I changed the name of that method everything behaved as  
expected. Apparently the controller noticed the key-value path was  
available and offered a chance of bypassing the nib. Does that make  
any sense or am I totally wrong here? (Couldn't find an explanation in  
the documentation...)


___

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


rerunning an NSOperation object

2011-03-05 Thread Shane
I have an NSOperation object that has been placed in an
NSOperationQueue. I then execute that NSOperation and all works
normal.

What I'd like to do is then run that task again, however, when I do
run it I get the following error when trying to add that object to the
queue again.

 Caught NSInvalidArgumentException*** -[NSOperationQueue
addOperation:]: operation is finished and cannot be enqueued

I then see that the "NSOperationQueue Class Reference" says this about
addOperation: ...
"Similarly, this method throws an NSInvalidArgumentException exception
if the operation is currently executing or has already finished
executing."

So it has finished executing, and I'd like to know how to execute it
again but w/o having to build a new object. Is there a way to rerun an
NSOperation object, or should I do something else besides call
addOperation: again?
___

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: rerunning an NSOperation object

2011-03-05 Thread Robert Martin
From the docs for NSOperation:

... "An operation object is a single-shot object—that is, it executes its task 
once and cannot be used to execute it again." 


On Mar 5, 2011, at 10:33 PM, Shane wrote:

> I have an NSOperation object that has been placed in an
> NSOperationQueue. I then execute that NSOperation and all works
> normal.
> 
> What I'd like to do is then run that task again, however, when I do
> run it I get the following error when trying to add that object to the
> queue again.
> 
> Caught NSInvalidArgumentException*** -[NSOperationQueue
> addOperation:]: operation is finished and cannot be enqueued
> 
> I then see that the "NSOperationQueue Class Reference" says this about
> addOperation: ...
> "Similarly, this method throws an NSInvalidArgumentException exception
> if the operation is currently executing or has already finished
> executing."
> 
> So it has finished executing, and I'd like to know how to execute it
> again but w/o having to build a new object. Is there a way to rerun an
> NSOperation object, or should I do something else besides call
> addOperation: again?

___

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


Why Annotations callout sometimes not work ?

2011-03-05 Thread zhixiong ye
I add a NSArray of Annotations in a mapview, she the canshowcallout=yes,but 
sometimes some of the annotations don't show callout, tap it more maybe work, 
what's the problem?

-(void)mapView:(MKMapView *)mapView didSelectAnnotationView:(MKAnnotationView 
*)view {
Event *aEvent = nil;
UIImageView *imageView = nil;


if ([view.annotation isKindOfClass:[Event class]]) {
aEvent = (Event *)view.annotation;
MKCoordinateRegion currentRegion;
currentRegion.center = aEvent.coordinate;
currentRegion.span.latitudeDelta = 0.005;
currentRegion.span.longitudeDelta = 0.005;

[self.mapView setRegion:currentRegion animated:YES];

}
if ([view.leftCalloutAccessoryView isKindOfClass:[UIImageView class]]) {
imageView = (UIImageView *) view.leftCalloutAccessoryView;
}

if (aEvent && imageView) {
imageView.image = [UIImage imageWithData:aEvent.image];

}


NSLog(@"title is %@",view.annotation.title);
NSLog(@"image is %@",imageView.image);
}


i found that problem is caused by adding these code

MKCoordinateRegion currentRegion;
currentRegion.center = aEvent.coordinate;
currentRegion.span.latitudeDelta = 0.005;
currentRegion.span.longitudeDelta = 0.005;

[self.mapView setRegion:currentRegion animated:YES];
but why?___

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


Invitation to connect on LinkedIn

2011-03-05 Thread Arnab Ganguly via LinkedIn
LinkedIn
Arnab Ganguly requested to add you as a connection on LinkedIn:
--

Cameron,

I'd like to add you to my professional network on LinkedIn.

- Arnab

Accept invitation from Arnab Ganguly
http://www.linkedin.com/e/m41s91-gkxkx1lh-3u/7CEPLQL12CQ4K1l0S-51en6YhLE4yif1p-H_BC7/blk/I1173642802_3/1BpC5vrmRLoRZcjkkZt5YCpnlOt3RApnhMpmdzgmhxrSNBszYPnP8Me38QdzcTcj59bRZncTlkqCYMbPkQcjARdPAQd38LrCBxbOYWrSlI/EML_comm_afe/

View invitation from Arnab Ganguly
http://www.linkedin.com/e/m41s91-gkxkx1lh-3u/7CEPLQL12CQ4K1l0S-51en6YhLE4yif1p-H_BC7/blk/I1173642802_3/3dvcz0UczgScPsNckALqnpPbOYWrSlI/svi/
 
--

DID YOU KNOW LinkedIn can help you find the right service providers using 
recommendations from your trusted network? Using LinkedIn Services, you can 
take the risky guesswork out of selecting service providers by reading the 
recommendations of credible, trustworthy members of your network. 
http://www.linkedin.com/e/m41s91-gkxkx1lh-3u/svp/inv-25/

 
-- 
(c) 2011, LinkedIn Corporation
___

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