Re: Instance an from an NSString Class name

2010-09-21 Thread koko

Word up to Seth and Jerry!

I'll be a Cocoa engineer yet!

-koko


On Sep 21, 2010, at 11:07 PM, Seth Willits wrote:


On Sep 21, 2010, at 9:21 PM, k...@highrolls.net wrote:

		NSString *class = [NSString stringWithCString:[data bytes]  
encoding:NSASCIIStringEncoding];

Class obstacle = NSClassFromString(class);
		id thisObstacle = [[obstacle alloc] initWithImage:[sender  
draggedImage] andLocation:[sender draggingLocation]];

[m_obstacles addObject:thisObstacle];

I don't think I have to retain thisObstacle as m_obstacles take  
ownership.


No, but you'd better release it after you add it to the array  
otherwise you're leaking it. There's no such thing as "taking  
ownership" in an exclusive sense. m_obstacles simply retains it when  
you added it to the array. But the retain count is already 1 from  
the alloc, so now it's at +2. If you remove it from the array it's  
at +1 forever. You need to balance that alloc.





However, must I retain [sender draggedImage] so the code becomes:

		NSString *class = [NSString stringWithCString:[data bytes]  
encoding:NSASCIIStringEncoding];

Class obstacle = NSClassFromString(class);
		id thisObstacle = [[obstacle alloc] initWithImage:[[sender  
draggedImage] retain] andLocation:[sender draggingLocation]];

[m_obstacles addObject:thisObstacle];



Also no. The obstacle would retain it, if needed, as Jerry said.



--
Seth Willits



___

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/koko%40highrolls.net

This email sent to k...@highrolls.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


i5/i7 w/External 24" LED Cinema identifying screens - testing help

2010-09-21 Thread Trygve Inda
Does anyone here have the above set up... And are willing to test a small
app to retrieve display information?

Since these machines have two processors for video, the CGDirectDisplayID is
not unique any longer and we are looking for ways to uniquely identify a
screen.

Please contact me off list.

Thanks,

Trygve


___

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: Instance an from an NSString Class name

2010-09-21 Thread Seth Willits
On Sep 21, 2010, at 9:21 PM, k...@highrolls.net wrote:

>   NSString *class = [NSString stringWithCString:[data bytes] 
> encoding:NSASCIIStringEncoding];
>   Class obstacle = NSClassFromString(class);
>   id thisObstacle = [[obstacle alloc] initWithImage:[sender 
> draggedImage] andLocation:[sender draggingLocation]];
>   [m_obstacles addObject:thisObstacle];
> 
> I don't think I have to retain thisObstacle as m_obstacles take ownership.

No, but you'd better release it after you add it to the array otherwise you're 
leaking it. There's no such thing as "taking ownership" in an exclusive sense. 
m_obstacles simply retains it when you added it to the array. But the retain 
count is already 1 from the alloc, so now it's at +2. If you remove it from the 
array it's at +1 forever. You need to balance that alloc. 



> However, must I retain [sender draggedImage] so the code becomes:
> 
>   NSString *class = [NSString stringWithCString:[data bytes] 
> encoding:NSASCIIStringEncoding];
>   Class obstacle = NSClassFromString(class);
>   id thisObstacle = [[obstacle alloc] initWithImage:[[sender 
> draggedImage] retain] andLocation:[sender draggingLocation]];
>   [m_obstacles addObject:thisObstacle];


Also no. The obstacle would retain it, if needed, as Jerry said.



--
Seth Willits



___

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: Instance an from an NSString Class name

2010-09-21 Thread Jerry Krinock

On 2010 Sep 21, at 21:21, k...@highrolls.net wrote:
> However, must I retain [sender draggedImage] so the code becomes:
> 
> id thisObstacle = [[obstacle alloc] initWithImage:[[sender draggedImage] 
> retain] andLocation:[sender draggingLocation]];

No.  Your 'obstacle' should retain its 'image' as an instance variable if it 
needs 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


Re: Instance an from an NSString Class name

2010-09-21 Thread koko

Thanks!  Now I have:

		NSString *class = [NSString stringWithCString:[data bytes]  
encoding:NSASCIIStringEncoding];

Class obstacle = NSClassFromString(class);
		id thisObstacle = [[obstacle alloc] initWithImage:[sender  
draggedImage] andLocation:[sender draggingLocation]];

[m_obstacles addObject:thisObstacle];

And I now have an instance of the class stored in an array.  I don't  
think I have to retain thisObstacle as m_obstacles take ownership.


However, must I retain [sender draggedImage] so the code becomes:

		NSString *class = [NSString stringWithCString:[data bytes]  
encoding:NSASCIIStringEncoding];

Class obstacle = NSClassFromString(class);
		id thisObstacle = [[obstacle alloc] initWithImage:[[sender  
draggedImage] retain] andLocation:[sender draggingLocation]];

[m_obstacles addObject:thisObstacle];




On Sep 21, 2010, at 10:08 PM, Stephen J. Butler wrote:


On Tue, Sep 21, 2010 at 11:01 PM,   wrote:
Given an NSString which is the name of a class what voodoo do I  
perform to

create an instance of that class?


Use NSClassFromString().



___

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: Instance an from an NSString Class name

2010-09-21 Thread Roland King
NSClassFromString

A method I always have trouble remembering and never find when I search. 



On Sep 22, 2010, at 12:01, k...@highrolls.net wrote:

> Given an NSString which is the name of a class what voodoo do I perform to 
> create an instance of that class?
> 
> -koko
> ___
> 
> 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: Instance an from an NSString Class name

2010-09-21 Thread Stephen J. Butler
On Tue, Sep 21, 2010 at 11:01 PM,   wrote:
> Given an NSString which is the name of a class what voodoo do I perform to
> create an instance of that class?

Use NSClassFromString().
___

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


Instance an from an NSString Class name

2010-09-21 Thread koko
Given an NSString which is the name of a class what voodoo do I  
perform to create an instance of that class?


-koko
___

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 a non-standard layer property

2010-09-21 Thread Scott Anguish
can you please file a bug on this?

custom animations are missing at the moment (sadly) but adding that and the 
@dynamic would be a very useful bug.


On Sep 20, 2010, at 7:24 PM, Kenneth Baxter wrote:

> Brilliant! Works now, thanks David. 
> 
> Is there somewhere I can find out more about this? It is not mentioned in the 
> Core Animation Programming Guide (2010-08-12), and I have got two e-books on 
> core animation, and it is not mentioned in either of them.
> 
> Thanks
> 
> Ken
> 
> On 21 Sep, 2010,at 09:07 AM, David Duncan  wrote:
> 
> On Sep 20, 2010, at 3:42 PM, Kenneth Baxter wrote:
> 
>> To see the changes as they are made, in addition to the normal synthesize of 
>> the testPoint, I have implemented the setter as follows:
> 
> 
> There's your problem. Your not supposed to @synthesize these properties. 
> Unless you let Core Animation define them (by declaring them @dynamic) they 
> cannot be animated and you will see the symptoms you see. In your 
> -drawInContext: method you can then query the property to get the current 
> value.
> --
> David Duncan
> 
> ___
> 
> 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/scott%40cocoadoc.com
> 
> This email sent to sc...@cocoadoc.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


NSTextView

2010-09-21 Thread albert jordan
Greetings,

I'm having a problem with NSTextView, and I'm wondering if anyone can help 
verify the source of the problem and suggest alternatives.

I'm trying to develop an automated test program for Android handsets.  I can 
connect two Android handsets to my MAC, and among other things, I would like to 
have customized windows for each device that will display logging information 
coming from the handset.


I have setup an "NSTextView in an NSScrollView" item in interface builder, and 
my window controller objects has an IBOutlet that is linked to TextView of the 
item (if I connect it to the NSScrollView, I don't get any text).  Anytime that 
I get a log statement, I use the insert text method to print out the log line 
in the view...

[myTextView insertText: (NSString *) newLogLine];


The problem is that this interface freezes.  If I change the program so that 
every 100th log line is entered, then things work fine.  Reading the NSTextView 
documentation I note the following for "insertText"...

"This method is the entry point for inserting text typed by the user and is 
generally not suitable for other purposes."

So my assumption is that insertText in TextView is not suited for cases where 
new strings are sent rapidly.  Is this a correct interpretation?  Is this 
anyone else's experience?

Does anyone know a work around this?  NSLog/Concole works fine, but since I 
have multiple devices I would like to break the log entries in two different 
windows.  

Thanks in advance.

Regards,

albert
___

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: NSRunLoop behavior

2010-09-21 Thread Rafael Cerioli
Ok, thank you for your answer.

So, you are telling me that [self performSelector:@selector(waitUntilReady) 
withObject:nil afterDelay:1] is an input source ? What exactly is the input 
source, my selector or the timer that when fired, will call my selector ? I 
thought sources were like timers and port and stuff like that, and they were 
waking up the run loop, which is notifying the observers ?

Another question : say you have two sources (or observers?). The first one to 
be processed calls a [[NSRunLoop currentRunLoop] runUntilDate:someDate]. Will 
the second one be processed as the first one never exits ? Will the first one 
be processed recursively (no...) ?

Thank you !

Rafael


On 2010-09-21, at 9:54 AM, Keary Suska wrote:

> On Sep 21, 2010, at 5:55 AM, Rafael Cerioli wrote:
> 
>> Hi,
>> 
>> I'm trying to understand how run loops work. I've written this useless piece 
>> of code and I'm not sure why "success" does not show up...
>> What happens is that waitUntilReady never terminates, because it seems that 
>> the runUntilDate in myButtonAction never ends as well.
> 
> Yes, as that is what your code is doing.
> 
>> My theory would be that calling a runUntilDate from myButtonAction 
>> (myButtonAction is started by a run loop observer)  will just prevent other 
>> sources and observers in the *current* run loop's loop (or run loop's run 
>> ??) to be processed until myButtonAction terminates.
> 
> No--there is no "prevention" whatsoever. -runUntilDate: tells the current 
> runloop *specifically* to process all input sources, and to not exit until 
> all sources are processed *and* the specified expiration date has been 
> reached. 
> 
>> So, waitUntilReady's call to runUntilDate would prevent the end of 
>> myButtonAction's current run loop's loop.
>> 
>> Does someone have more info about that ?
>> 
>> - (void) myButtonAction {
>>  // A button event has been sent, waking up the run loop and calling 
>> that method 
>> 
>>  // this will be called in 1 second
>>  [self performSelector:@selector(waitUntilReady) withObject:nil 
>> afterDelay:1];
> 
> This is an input source, so the runloop will not exit until the method exits.
> 
>>  // process the current run loop during 10 seconds :
>>  [[NSRunLoop currentRunLoop] runUntilDate:[NSDate 
>> dateWithTimeIntervalSinceNow:10]];
> 
> Which never happens, as you never get to this line, because the method cannot 
> exit.
> 
>>  [self setReady:YES];
>> }
>> 
>> - (void) waitUntilReady {
>> 
>>  while(![self isReady]) {
>>  // this should just process the run loop once :
>>  [[NSRunLoop currentRunLoop]  runUntilDate:[NSDate date]];
>>  }
>> 
>>  NSLog(@"success!");
>> }
> 
> HTH,
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 

___

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: How to double tap event on a UIButton

2010-09-21 Thread Matt Neuburg
On Mon, 20 Sep 2010 06:38:32 +0200, " Jonathan Chac?n "
 said:
>What can I manage the double tap gesture on a UIButton?

Or (still carrying on from my previous note, sorry) use the technique shown
in the docs: on the first tap, start a delayed performance to do the
single-tap response, and then when the second tap arrives, if it's within a
short time of the first tap, cancel the delayed performance and do the
double-tap response instead. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings



___

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: How to double tap event on a UIButton

2010-09-21 Thread Matt Neuburg
On Mon, 20 Sep 2010 06:38:32 +0200, " Jonathan Chac?n "
 said:
>What can I manage the double tap gesture on a UIButton?

Make a view that *looks* like a button and use gesture recognizers. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings



___

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: Animated mask for UIViews?

2010-09-21 Thread Matt Neuburg
On Tue, 21 Sep 2010 11:22:06 -0400, "Eric E. Dolecki" 
said:
>Can one easily apply a
>mask to a UIView and animate it's dimensions?

One can easily apply a mask to a layer, and since all drawing (even a view's
drawing) is actually a layer, that's the same thing. And one can animate
aspects of layer drawing, so the answer would seem to be yes; for example,
if the mask were shaped like an ellipse, you could animate a change in the
size of the ellipse. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings



___

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: What's the point of @properties?

2010-09-21 Thread Matt Neuburg
On Sun, 19 Sep 2010 13:29:20 -0700, Bill Bumgarner  said:

>- synthesis "just works" (pretty much every attempt at hand-rolled atomicity
I've seen has been wrong or bog slow)

And even if properties did nothing for me beyond writing my accessors for
me, it would still be worth it. They don't actually save me from much work;
okay, I don't have to write the accessors, but I still have to say
@synthesize; and they know nothing about releasing in dealloc. But before
properties I used to jump through hoops just so as not to have to declare an
ivar, because it was so much work to support it; with properties, that pain
in my hands is gone.

On Mon, 20 Sep 2010 03:56:20 -0700, Chris Hanson  said:
>Don't think of dot syntax as syntactic sugar for sending messages. Think of dot
syntax as the way to access the state exposed by an object, and bracket syntax
as the way to have an object do something.

No, I think that's bollocks. Dot syntax is *exactly* syntactic sugar for
calling the accessor, and using it correctly depends upon keeping that fact
firmly in mind. m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings



___

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: Need functionality of CAShapeLayer in 10.5

2010-09-21 Thread David Duncan
On Sep 21, 2010, at 6:14 PM, Kenneth Baxter wrote:

> Just a quick question about this - I notice that you say to use a timer which 
> I presume you say deliberately rather than using the automatic needsDisplay 
> and recalculating during display.

The automatic -needsDisplayOnBoundsChange will cause you to draw only once, at 
the new bounds value, not for every frame in-between. If that is acceptable, 
then that should work too. If you would have just changed the frame/bounds to 
implement the animation, that is fine as well. Either way, the implementation 
should be relatively straightforward.
--
David Duncan

___

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: Need functionality of CAShapeLayer in 10.5

2010-09-21 Thread Kenneth Baxter

Just a quick question about this - I notice that you say to use a timer which I 
presume you say deliberately rather than using the automatic needsDisplay and 
recalculating during display.

The way I was thinking of doing it would have resulted in the recalculation of 
the path during the drawing, which in turn would have meant that I would want 
to change the frame/bounds during the drawing, which presumably would not be a 
good thing, right? Is this why you would say to use a timer?

So presumably that means I would get the timer to fire frequently and then ask 
the presentation layer for the values for my animating points, and if they have 
changed, I recalculate my path, and update the frame if necessary, using a 
transaction which disables animation, and then calls setNeedsDisplay.

Sorry to need to bother you for the clarification, but I just need to make sure 
I understand correctly.

On 22 Sep, 2010,at 10:32 AM, David Duncan  wrote:

On Sep 21, 2010, at 5:02 PM, Kenneth Baxter wrote:


Any suggestions would be most welcome.



With a requirement of 10.5, about all you can do is call -setNeedsDisplay from 
a timer to implement the animation yourself, unless your path can be animated 
well enough by just stretching/squeezing the layer. Either way your talking 
about drawing your path into a plain CALayer.
--
David Duncan

___

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: One last try: how do you make a bookmark bar like Safari?

2010-09-21 Thread Brad Stone
These are all great resources.  Thanks

On Sep 20, 2010, at 6:08 PM, John Nairn wrote:

> On Sep 20, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:
> 
>> I sent this out last week and go no replies.  Please excuse me for sending 
>> it out again but I want to try one more time in case someone has an answer.
>> 
>> I've been spending some time searching and thinking about how I can make a 
>> bookmark bar like in Safari or Firefox.  It has some of the characteristics 
>> of a toolbar especially when the window is small it puts the remaining 
>> toolbar items in a drop-down menu but it also has some of the properties of 
>> a collectionView with editable views, reordering and dragging.  I've seen 
>> some threads here but haven't found anything definitive.
>> 
>> How have any of you implemented one?
> 
> 
> You need a custom control. I found this one
> 
> http://www.positivespinmedia.com/dev/PSMTabBarControl.html
> 
> which is freely available under BSD license. It looks good, but I have not 
> gotten as far yet as implementing it in any of my applications.
> 
> ---
> John Nairn
> GEDitCOM - Genealogy Software for the Macintosh
> http://www.geditcom.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


Re: Need functionality of CAShapeLayer in 10.5

2010-09-21 Thread Kenneth Baxter

OK, thanks for that David - I'll take that route then.

On 22 Sep, 2010,at 10:32 AM, David Duncan  wrote:

On Sep 21, 2010, at 5:02 PM, Kenneth Baxter wrote:


Any suggestions would be most welcome.



With a requirement of 10.5, about all you can do is call -setNeedsDisplay from 
a timer to implement the animation yourself, unless your path can be animated 
well enough by just stretching/squeezing the layer. Either way your talking 
about drawing your path into a plain CALayer.
--
David Duncan

___

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: Need functionality of CAShapeLayer in 10.5

2010-09-21 Thread David Duncan
On Sep 21, 2010, at 5:02 PM, Kenneth Baxter wrote:

> Any suggestions would be most welcome.


With a requirement of 10.5, about all you can do is call -setNeedsDisplay from 
a timer to implement the animation yourself, unless your path can be animated 
well enough by just stretching/squeezing the layer. Either way your talking 
about drawing your path into a plain CALayer.
--
David Duncan

___

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


Need functionality of CAShapeLayer in 10.5

2010-09-21 Thread Kenneth Baxter

Hi all, I had gone through my initial design for a project I am working on and 
one part of it really needs to use CAShapeLayer, but I just realized that it's 
only available in 10.6+, and I have to support 10.5.

Essentially I have two layers that have a bezier path drawn between them. The 
two layers at each end of the path are moved during animations, and the bezier 
path needs to be adjusted to stay connected with the layers at each end Seems 
to me that this would be easily done by CAShapeLayer, if I could use it.

I presume people were probably doing this type of thing before CAShapeLayer 
came along, so I'm wondering if there is some sample code for an equivalent of 
CAShapeLayer or at least something that will allow me to easily update the path 
during the animation.

I was thinking of using a startPoint and endPoint for the path which are 
animated, and have setNeedsDisplayForKey set, and just recalculate the path in 
the drawing method

Is this a good approach, or is there a better way, or some existing code that 
may help out with this?

It would be nice to be able to do something that has an API match with 
CAShapeLayer, so that when I can ditch 10.5 support (hopefully soon), I could 
just move straight to CAShapeLayer without having to change anything else, but 
that would presumably mean animating an arbitrary number of points in the 
bezier path and handling all sorts of situations like one path having more 
points than the other etc.

Any suggestions would be most welcome.

Thanks

Ken
___

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: GC, plain C structs, and when to use __strong

2010-09-21 Thread Quincey Morris
On Sep 21, 2010, at 15:37, Sean McBride wrote:

> If I have a plain C struct that contains some Obj-C object pointers like:
> 
> struct {
>  int boring;
>  NSString* string;
> } MyStruct
> 
> What must I do to be safe in GC?
> 
> a) I know I must allocate my structs using NSAllocateCollectable and
> NSScannedOption.
> b) I'm pretty sure I don't need a '__strong' in my struct declaration.
> (doc say "__strong is implicitly part of any declaration of an Objective-
> C object reference type.")
> c) I'm pretty sure if I use a pointer to this struct as an ivar, I must
> tag it with __strong.

At risk of getting myself into trouble, I'd say correct, correct and correct.

> d) I'm not sure about passing pointers to this struct around.  Need I
> tag all parameters and return values as __strong too?  ex:
> 
> void DoThing (__strong MyStruct* param) { ... }

At ditto risk, I'd say no to '__strong'. Variable 'param' is a stack variable 
is therefore a *root* reference, and as such the concept of strong or weak 
doesn't apply. (That is, AFAIK, applying '__strong' or '__weak' to a stack 
variable *never* has any effect on its behavior in any 
way.)___

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: Access object from another view

2010-09-21 Thread Steve Wetzel
I thought I had tried putting the setText statement after the addSubView but I 
went back and tried it again and it worked.  Thanks for the suggestion.

I cannot simply use IB to put the same label text in as the text label is 
calculated from user input.

Thanks!

Steve






On Sep 21, 2010, at Sep 21:6:03 PM, Quincey Morris wrote:

> On Sep 21, 2010, at 14:03, Steve Wetzel wrote:
> 
>> I could not get the 
>> 
>> [self.viewController1.label2.text 
>> 
>> or the 
>> 
>> [self view addSubview:viewController2.view];
>> 
>> to work for some reason.  Then it dawned on me that I could set the value 
>> right before I added the Subview!
>> 
>> [viewController2.label2 setText:label1.text];
>> [self.view addSubview:viewController2.view];
>> 
>> This works, although for some reason the label does not update unless I 
>> reload the view.  I will figure out what is going on there.
> 
> The usual cause of such behavior is the timing of NIB loading. There are 
> various points at which code can be executed (init..., awakeFromNib, 
> viewDidMoveToSuperview, etc), and it can be hard to keep track of the 
> correctness of your assumptions of what must have happened already.
> 
> In order to transfer the label successfully, you need both view1 and view2 to 
> have been loaded. Since NSViewController's 'view' method causes the view to 
> be loaded if necessary, you can be certain it's done *after* executing:
> 
>   [self.view addSubview:viewController2.view];
> 
> since that references both views. Did you try putting the other line:
> 
>   [viewController2.label2 setText:label1.text];
> 
> *after* the 'addSubview' line instead of before?
> 
> Is the label static in view1's NIB? If so, why can't you just use IB to put 
> the same label text in view2 and have no code at all?
> 
> 

___

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: Access object from another view

2010-09-21 Thread mmalc Crawford

On Sep 21, 2010, at 2:49 pm, Steve Wetzel wrote:

> Then [self.view addSubView:viewController2.view]; brings up the subview.
> 
You should [almost certainly] not be doing this.
If you want to display another view controller's view, you should use an 
appropriate technique to present the view controller itself. In many case this 
would involve using a navigation controller (UINavigationController).

To learn more about application architecture using view controllers, read the 
View Controller Programming Guide 

For general design guidelines etc. see 


To address the general question of "how do I access an object from another 
view": As you appear to be asking it, you don't.
The general pattern is that before you present a view, you pass to its view 
controller any data that will be needed for display. It's up to the view 
controller to then project the relevant information into its view.

mmalc

___

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: Access object from another view

2010-09-21 Thread Quincey Morris
On Sep 21, 2010, at 14:03, Steve Wetzel wrote:

> I could not get the 
> 
> [self.viewController1.label2.text 
> 
> or the 
> 
> [self view addSubview:viewController2.view];
> 
> to work for some reason.  Then it dawned on me that I could set the value 
> right before I added the Subview!
> 
> [viewController2.label2 setText:label1.text];
> [self.view addSubview:viewController2.view];
> 
> This works, although for some reason the label does not update unless I 
> reload the view.  I will figure out what is going on there.

The usual cause of such behavior is the timing of NIB loading. There are 
various points at which code can be executed (init..., awakeFromNib, 
viewDidMoveToSuperview, etc), and it can be hard to keep track of the 
correctness of your assumptions of what must have happened already.

In order to transfer the label successfully, you need both view1 and view2 to 
have been loaded. Since NSViewController's 'view' method causes the view to be 
loaded if necessary, you can be certain it's done *after* executing:

[self.view addSubview:viewController2.view];

since that references both views. Did you try putting the other line:

[viewController2.label2 setText:label1.text];

*after* the 'addSubview' line instead of before?

Is the label static in view1's NIB? If so, why can't you just use IB to put the 
same label text in view2 and have no code at all?


___

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


NSOperation and threadDictionary

2010-09-21 Thread Rick Mann
Does iOS (and Mac OS X) clean up thread-local storage upon the completion of an 
NSOperation? It seems dangerous to rely on every operation to clean up its own 
mess. It also seems that an NSOperation should be able to pretend that it owns 
the thread on which it's running, and not have to worry about whatever a 
previous operation running on that thread might've done to the TLS.

I read the NSOperation and NSOperationQueue docs, as well as the docs for 
-[NSThread threadDictionary], but none of it mentions this topic.

I can experiment to find out, but would like to know what others know about 
this.

Thanks,
Rick

___

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: AXUIElementPostKeyboardEvent and Carbon applications

2010-09-21 Thread Eric Schlegel

On Sep 21, 2010, at 2:41 PM, AstroK Software wrote:

> So I am writing a Cocoa application for disabled that must be able to send 
> key presses to background application. For that I am using 
> AXUIElementPostKeyboardEvent which works quite fine, except when I want to 
> send key presses to Carbon apps like Microsoft Word or iTunes when they are 
> in the background. For Cocoa apps there is no absolutely no problem! Have you 
> ever encountered a behavior like this?
> 
> This is strange because when Carbon apps are in the foreground it works fine. 
> Do you think it could be related to the fact that my application is written 
> in Cocoa?

It's more likely that it's because the target apps are Carbon-based. I'm sure 
you'd see the same behavior regardless of whether your app is Carbon or Cocoa.

The exact behavior may be dependent on the specific app, but it's likely that 
when the application moves to the background, its key window loses focus, and 
when the keyboard event arrives, the app doesn't know where to send it (because 
no window is key) and therefore ignores it. 

-eric

___

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: Animated mask for UIViews?

2010-09-21 Thread Eric E. Dolecki
square masks that i'd animate - squish, elongate, etc. 6 masks - 1 per
UIView.


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Tue, Sep 21, 2010 at 6:11 PM, Alexander Spohr  wrote:

> What kind of masks?
> Bitmaps? Then use UIImageView and transparency.
> Vectors? UIBezierPath and CGBlendMode might help.
>
>atze
>
>
> Am 21.09.2010 um 17:22 schrieb Eric E. Dolecki:
>
> > I have a SWF that was created where masks are being animated. Now I was
> > asked to do the same thing for an iPhone application. Can one easily
> apply a
> > mask to a UIView and animate it's dimensions? I have about 6 UIViews that
> > stack on top of each other (staggered), and hopefully masks might be used
> to
> > expose them in animated mask ways. Is this easily doable?
>
___

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: Animated mask for UIViews?

2010-09-21 Thread Alexander Spohr
What kind of masks?
Bitmaps? Then use UIImageView and transparency.
Vectors? UIBezierPath and CGBlendMode might help.

atze


Am 21.09.2010 um 17:22 schrieb Eric E. Dolecki:

> I have a SWF that was created where masks are being animated. Now I was
> asked to do the same thing for an iPhone application. Can one easily apply a
> mask to a UIView and animate it's dimensions? I have about 6 UIViews that
> stack on top of each other (staggered), and hopefully masks might be used to
> expose them in animated mask ways. Is this easily doable?
___

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: Access object from another view

2010-09-21 Thread Steve Wetzel
I think that is what I did with the line 

[viewController2.label2 setText:label1.text];

Then [self.view addSubView:viewController2.view]; brings up the subview.

The only problem is that the text in label two is not displayed correctly until 
I release and reload the view.  I have a button to remove view which fires the 
code [self.view removefromSuperview];  then when i bring the view back up with 
the above code, the label has the correct text in it.

This seems to be something pretty simple and yet I am struggling with it.  What 
is a good resource for me to read that can give me a basic understanding of 
things like this?  Why do I have to bring this view up twice in order to see 
the proper text in the label?

Steve






On Sep 21, 2010, at Sep 21:4:11 PM, Eric E. Dolecki wrote:

> You could make a public method in the second and call that from the first to 
> set the text too I suppose.
> 
> 
>   Google Voice: (508) 656-0622
>   Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
>   http://blog.ericd.net
> 
> 
> 
> On Tue, Sep 21, 2010 at 5:03 PM, Steve Wetzel  wrote:
> Thanks Everyone.
> 
> I could not get the
> 
> [self.viewController1.label2.text
> 
> or the
> 
> [self view addSubview:viewController2.view];
> 
> to work for some reason.  Then it dawned on me that I could set the value 
> right before I added the Subview!
> 
> [viewController2.label2 setText:label1.text];
> [self.view addSubview:viewController2.view];
> 
> This works, although for some reason the label does not update unless I 
> reload the view.  I will figure out what is going on there.
> 
> Thanks for the suggestions.
> 
> Steve
> 
> 
> 
> 
> 
> 
> On Sep 21, 2010, at Sep 21:3:25 PM, Conrad Shultz wrote:
> 
> > -BEGIN PGP SIGNED MESSAGE-
> > Hash: SHA1
> >
> > On 9/21/10 11:57 AM, Steve Wetzel wrote:
> >> How do I access and object on one view from another view?  I cannot
> >> figure it out.
> >>
> >> I have two view controllers and two views.  Lets call them
> >> viewController1 and viewController2 and view1 and view2.
> >> ViewController1 loads the second view by:
> >>
> >> [self.view addSubview:viewController2.view];
> >>
> >> There is a label in view1 that I want to get the value of the text
> >> from in the code for viewController2.  How do I do this?
> >
> > Caveat: you ought to listen to Quincey's advice, since it will give a
> > more robust, or at least a cleaner, implementation.
> >
> > That said, for the specific situation at hand, UIView has a superview
> > property that returns a reference to, well, the view's superview (if it
> > exists).  If you have the label as a property of view1 ("theLabel"), you
> > could do something like the following (in viewController2):
> >
> > UILabel *theLabel = [[[self view] superview] theLabel];
> >
> > If it's a tagged view, you could do something like:
> >
> > NSInteger labelTag = (whatever you set, probably in IB);
> > UILabel *theLabel = [[[self view] superview] viewWithTag:labelTag];
> >
> > (Since properties are involved, you are of course free to use dot syntax
> > in many places above if that's your preference.)
> >
> > - --
> > Conrad Shultz
> >
> > Synthetiq Solutions
> > www.synthetiqsolutions.com
> > -BEGIN PGP SIGNATURE-
> > Version: GnuPG v1.4.7 (Darwin)
> > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> >
> > iD8DBQFMmRSvaOlrz5+0JdURApMYAJ0aAv996lOHMDyY5oTKg0ju0LIbIACePwij
> > i3EBvDqS2WGzo+wnrBT9Mz8=
> > =Ea2B
> > -END PGP SIGNATURE-
> 
> ___
> 
> 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/edolecki%40gmail.com
> 
> This email sent to edole...@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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


AXUIElementPostKeyboardEvent and Carbon applications

2010-09-21 Thread AstroK Software
Hi,

sorry if it's not exactly a Cocoa question, but my application is written in 
Cocoa and it uses Carbon calls to accessibility functions.

So I am writing a Cocoa application for disabled that must be able to send key 
presses to background application. For that I am using 
AXUIElementPostKeyboardEvent which works quite fine, except when I want to send 
key presses to Carbon apps like Microsoft Word or iTunes when they are in the 
background. For Cocoa apps there is no absolutely no problem! Have you ever 
encountered a behavior like this?

I am using the following code:

if (type == kCGEventKeyDown)
{
keyDown = true;
err = AXUIElementPostKeyboardEvent(backgroundApp, (CGCharCode)0, 
(CGKeyCode)keyCode, keyDown);
}
else if (type == kCGEventKeyUp)
{
keyDown = false;
err = AXUIElementPostKeyboardEvent(backgroundApp, (CGCharCode)0, 
(CGKeyCode)keyCode, keyDown);
}

This is strange because when Carbon apps are in the foreground it works fine. 
Do you think it could be related to the fact that my application is written in 
Cocoa?

Thanks in advance,

 -- Arthur;

--
Arthur VIGAN
AstroK Software
cont...@astrok-software.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


Re: Toolbar Item -Menu Form Representation - Key Equivalent

2010-09-21 Thread Richard Somers

On Sep 21, 2010, at 11:54 AM, Kyle Sluder wrote:


The real solution is to not create toolbar items without corresponding
menu items, as per the HIG: ...

This has the added benefit of making it possible to use the inline
search field in the Help menu to find and activate the menu item.


True, thanks for the reminder. The HIG states "Any item in a toolbar  
should also be available as a menu command."


As I see it there are several benefits with this.

1) As you mentioned, the inline search field in the Help menu can be  
used to find and activate a menu command.


2) The user can assign a keyboard shortcut to a menu command.

3) The user can directly access the command from the main menu.

I am working on a complex vertical market application. The toolbar is  
being designed as an integral part of the application. It is one of  
the preferred methods for accessing the available tools. For this  
particular application there may not be much benefit to the user by  
duplicating the toolbar command structure in the main menu bar. If I  
am wrong or change my mind I can easily put it in later. For now the  
key equivalent is working for both the toolbar item and the menu form  
representation of that item with the work around mentioned.


--Richard

___

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: Access object from another view

2010-09-21 Thread Steve Wetzel
Thanks Everyone.

I could not get the 

[self.viewController1.label2.text 

or the 

[self view addSubview:viewController2.view];

to work for some reason.  Then it dawned on me that I could set the value right 
before I added the Subview!

[viewController2.label2 setText:label1.text];
[self.view addSubview:viewController2.view];

This works, although for some reason the label does not update unless I reload 
the view.  I will figure out what is going on there.

Thanks for the suggestions.

Steve






On Sep 21, 2010, at Sep 21:3:25 PM, Conrad Shultz wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> On 9/21/10 11:57 AM, Steve Wetzel wrote:
>> How do I access and object on one view from another view?  I cannot
>> figure it out.
>> 
>> I have two view controllers and two views.  Lets call them
>> viewController1 and viewController2 and view1 and view2.
>> ViewController1 loads the second view by:
>> 
>> [self.view addSubview:viewController2.view];
>> 
>> There is a label in view1 that I want to get the value of the text
>> from in the code for viewController2.  How do I do this?
> 
> Caveat: you ought to listen to Quincey's advice, since it will give a
> more robust, or at least a cleaner, implementation.
> 
> That said, for the specific situation at hand, UIView has a superview
> property that returns a reference to, well, the view's superview (if it
> exists).  If you have the label as a property of view1 ("theLabel"), you
> could do something like the following (in viewController2):
> 
> UILabel *theLabel = [[[self view] superview] theLabel];
> 
> If it's a tagged view, you could do something like:
> 
> NSInteger labelTag = (whatever you set, probably in IB);
> UILabel *theLabel = [[[self view] superview] viewWithTag:labelTag];
> 
> (Since properties are involved, you are of course free to use dot syntax
> in many places above if that's your preference.)
> 
> - -- 
> Conrad Shultz
> 
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.7 (Darwin)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iD8DBQFMmRSvaOlrz5+0JdURApMYAJ0aAv996lOHMDyY5oTKg0ju0LIbIACePwij
> i3EBvDqS2WGzo+wnrBT9Mz8=
> =Ea2B
> -END PGP SIGNATURE-

___

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: Access object from another view

2010-09-21 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 9/21/10 11:57 AM, Steve Wetzel wrote:
> How do I access and object on one view from another view?  I cannot
> figure it out.
> 
> I have two view controllers and two views.  Lets call them
> viewController1 and viewController2 and view1 and view2.
> ViewController1 loads the second view by:
> 
> [self.view addSubview:viewController2.view];
> 
> There is a label in view1 that I want to get the value of the text
> from in the code for viewController2.  How do I do this?

Caveat: you ought to listen to Quincey's advice, since it will give a
more robust, or at least a cleaner, implementation.

That said, for the specific situation at hand, UIView has a superview
property that returns a reference to, well, the view's superview (if it
exists).  If you have the label as a property of view1 ("theLabel"), you
could do something like the following (in viewController2):

UILabel *theLabel = [[[self view] superview] theLabel];

If it's a tagged view, you could do something like:

NSInteger labelTag = (whatever you set, probably in IB);
UILabel *theLabel = [[[self view] superview] viewWithTag:labelTag];

(Since properties are involved, you are of course free to use dot syntax
in many places above if that's your preference.)

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFMmRSvaOlrz5+0JdURApMYAJ0aAv996lOHMDyY5oTKg0ju0LIbIACePwij
i3EBvDqS2WGzo+wnrBT9Mz8=
=Ea2B
-END PGP SIGNATURE-
___

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: Access object from another view

2010-09-21 Thread Steve Wetzel
I hope I am replying correctly, I am new at this.

The text in label1 is set with the setText method when the view is loaded.

What I am trying to achieve is putting some text whose value is in a label on 
view1 into a label on view2 (called label2).  I was hoping to do with with 
something likeā€¦

[label2 setText:;

of course this code would be going in viewController2 .

The objects are all created in NIB files.  The labels do not need to be 
dynamically linked. I just need this done when the view is loaded with the 
addSubview method.

As for which views and controllers are aware of or have references to other 
views and controller, well that is the issue.  I don't know how to reference an 
object on a view outside of the view controller I am working in.  Surely there 
must be a way to do this.

Steve



On Sep 21, 2010, at Sep 21:2:27 PM, Quincey Morris wrote:

> On Sep 21, 2010, at 11:57, Steve Wetzel wrote:
> 
>> How do I access and object on one view from another view?  I cannot figure 
>> it out.
>> 
>> I have two view controllers and two views.  Lets call them viewController1 
>> and viewController2 and view1 and view2.  ViewController1 loads the second 
>> view by:
>> 
>> [self.view addSubview:viewController2.view];
>> 
>> There is a label in view1 that I want to get the value of the text from in 
>> the code for viewController2.  How do I do this?
> 
> Probably no one can advise you on the *best* way to do this without knowing 
> exactly what you're trying to achieve. (Are there NIB files involved? How is 
> the label initialized in view1? Does the label change during execution in 
> such a way that view2 must be dynamically updated to match view1? Which views 
> and controllers are aware of -- have references to -- the other views and 
> controllers?)
> 
> The answer probably involves making the text value of the label a property of 
> viewController1, and propagating it to the other places via bindings, KVO or 
> setting via outlets.
> 
> 

___

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: Access object from another view

2010-09-21 Thread Quincey Morris
On Sep 21, 2010, at 11:57, Steve Wetzel wrote:

> How do I access and object on one view from another view?  I cannot figure it 
> out.
> 
> I have two view controllers and two views.  Lets call them viewController1 
> and viewController2 and view1 and view2.  ViewController1 loads the second 
> view by:
> 
> [self.view addSubview:viewController2.view];
> 
> There is a label in view1 that I want to get the value of the text from in 
> the code for viewController2.  How do I do this?

Probably no one can advise you on the *best* way to do this without knowing 
exactly what you're trying to achieve. (Are there NIB files involved? How is 
the label initialized in view1? Does the label change during execution in such 
a way that view2 must be dynamically updated to match view1? Which views and 
controllers are aware of -- have references to -- the other views and 
controllers?)

The answer probably involves making the text value of the label a property of 
viewController1, and propagating it to the other places via bindings, KVO or 
setting via outlets.


___

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


Access object from another view

2010-09-21 Thread Steve Wetzel
How do I access and object on one view from another view?  I cannot figure it 
out.

I have two view controllers and two views.  Lets call them viewController1 and 
viewController2 and view1 and view2.  ViewController1 loads the second view by:

[self.view addSubview:viewController2.view];

There is a label in view1 that I want to get the value of the text from in the 
code for viewController2.  How do I do this?


Steve






___

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: Toolbar Item -Menu Form Representation - Key Equivalent

2010-09-21 Thread Kyle Sluder
On Tue, Sep 21, 2010 at 7:07 AM, Richard Somers
 wrote:
> AppKit apparently does not let toolbar menu form representations respond to
> key equivalents. The work around is to call 'performKeyEquivalent:'
> yourself.

The real solution is to not create toolbar items without corresponding
menu items, as per the HIG:
http://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/XHIGWindows.html#//apple_ref/doc/uid/2961-BABIFCFJ

This has the added benefit of making it possible to use the inline
search field in the Help menu to find and activate the menu item.

--Kyle Sluder
___

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


Animated mask for UIViews?

2010-09-21 Thread Eric E. Dolecki
I have a SWF that was created where masks are being animated. Now I was
asked to do the same thing for an iPhone application. Can one easily apply a
mask to a UIView and animate it's dimensions? I have about 6 UIViews that
stack on top of each other (staggered), and hopefully masks might be used to
expose them in animated mask ways. Is this easily doable?


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.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: Toolbar Item -Menu Form Representation - Key Equivalent

2010-09-21 Thread Richard Somers

On Sep 20, 2010, at 9:08 PM, Richard Somers wrote:

The key equivalent will not work for a toolbar item, menu form  
representation.


AppKit apparently does not let toolbar menu form representations  
respond to key equivalents. The work around is to call  
'performKeyEquivalent:' yourself.


--Richard

___

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: NSRunLoop behavior

2010-09-21 Thread Keary Suska
On Sep 21, 2010, at 5:55 AM, Rafael Cerioli wrote:

> Hi,
> 
> I'm trying to understand how run loops work. I've written this useless piece 
> of code and I'm not sure why "success" does not show up...
> What happens is that waitUntilReady never terminates, because it seems that 
> the runUntilDate in myButtonAction never ends as well.

Yes, as that is what your code is doing.

> My theory would be that calling a runUntilDate from myButtonAction 
> (myButtonAction is started by a run loop observer)  will just prevent other 
> sources and observers in the *current* run loop's loop (or run loop's run ??) 
> to be processed until myButtonAction terminates.

No--there is no "prevention" whatsoever. -runUntilDate: tells the current 
runloop *specifically* to process all input sources, and to not exit until all 
sources are processed *and* the specified expiration date has been reached. 

> So, waitUntilReady's call to runUntilDate would prevent the end of 
> myButtonAction's current run loop's loop.
> 
> Does someone have more info about that ?
> 
> - (void) myButtonAction {
>   // A button event has been sent, waking up the run loop and calling 
> that method 
> 
>   // this will be called in 1 second
>   [self performSelector:@selector(waitUntilReady) withObject:nil 
> afterDelay:1];

This is an input source, so the runloop will not exit until the method exits.

>   // process the current run loop during 10 seconds :
>   [[NSRunLoop currentRunLoop] runUntilDate:[NSDate 
> dateWithTimeIntervalSinceNow:10]];

Which never happens, as you never get to this line, because the method cannot 
exit.

>   [self setReady:YES];
> }
> 
> - (void) waitUntilReady {
> 
>   while(![self isReady]) {
>   // this should just process the run loop once :
>   [[NSRunLoop currentRunLoop]  runUntilDate:[NSDate date]];
>   }
> 
>   NSLog(@"success!");
> }

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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: Lyrics in an application

2010-09-21 Thread Luca Ciciriello

Hi. I've found that SQLite is very useful in this kind of Mac|iPhone|iPad 
applications. Is easy to use, fast and can contain a huge quantity of data in a 
single "not to big" file.

 

Using Google you can find many examples how to use in Xcode SQLite and 
Objective-C. This one:

 

http://thinkitdifferently.wordpress.com/2009/03/22/using-sqlite3-c-api-in-cocoa-with-xcode/

 

is one of that example.

 

Bye.

 

Luca.
 
> From: edole...@gmail.com
> Date: Tue, 21 Sep 2010 08:20:38 -0400
> To: cocoa-dev@lists.apple.com
> Subject: Lyrics in an application
> 
> I'm new to trying this, but I am working on an app specific to a band and
> one of the features is the ability to browse albums, click on a song for
> that album and ultimately get the lyrics for that track. However I see that
> LyricWiki only allows a small portion of the lyrics to be returned via their
> APIs now. Should I make an XML file someplace on a server, include an XML
> file to the application (for offline), use a database local to the app, or
> just make a dictionary that contains the information?
> 
> 
> Google Voice: (508) 656-0622
> Twitter: eric_dolecki XBoxLive: edolecki PSN: eric_dolecki
> http://blog.ericd.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/luca_ciciriello%40hotmail.com
> 
> This email sent to luca_cicirie...@hotmail.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


Lyrics in an application

2010-09-21 Thread Eric E. Dolecki
I'm new to trying this, but I am working on an app specific to a band and
one of the features is the ability to browse albums, click on a song for
that album and ultimately get the lyrics for that track. However I see that
LyricWiki only allows a small portion of the lyrics to be returned via their
APIs now. Should I make an XML file someplace on a server, include an XML
file to the application (for offline), use a database local to the app, or
just make a dictionary that contains the information?


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.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


NSRunLoop behavior

2010-09-21 Thread Rafael Cerioli
Hi,

I'm trying to understand how run loops work. I've written this useless piece of 
code and I'm not sure why "success" does not show up...
What happens is that waitUntilReady never terminates, because it seems that the 
runUntilDate in myButtonAction never ends as well.

My theory would be that calling a runUntilDate from myButtonAction 
(myButtonAction is started by a run loop observer)  will just prevent other 
sources and observers in the *current* run loop's loop (or run loop's run ??) 
to be processed until myButtonAction terminates.

So, waitUntilReady's call to runUntilDate would prevent the end of 
myButtonAction's current run loop's loop.

Does someone have more info about that ?

- (void) myButtonAction {
// A button event has been sent, waking up the run loop and calling 
that method 

// this will be called in 1 second
[self performSelector:@selector(waitUntilReady) withObject:nil 
afterDelay:1];

// process the current run loop during 10 seconds :
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate 
dateWithTimeIntervalSinceNow:10]];

[self setReady:YES];
}




- (void) waitUntilReady {

while(![self isReady]) {
// this should just process the run loop once :
[[NSRunLoop currentRunLoop]  runUntilDate:[NSDate date]];
}

NSLog(@"success!");
}



Thank you, 
Rafael___

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: php and cocoa

2010-09-21 Thread Rufat A. Abdullayev

Hi Douglas

Here is the example of how to send HTTP request with parameters from cocoa
http://deusty.blogspot.com/2006/11/sending-http-get-and-post-from-cocoa.html

just make a php script on web server side that reads POST/GET variables sent 
from cocoa application and output desirable content

inside cocoa application create request and modify parameters according to what 
you will process by php script

for example lets assume you send via http request 'option' variable

just set in cocoa  (see above mentioned example this string used there)

NSString *post = @"option=image";   for image
NSString *post = @"option=quantity";for quantity
NSString *post = @"option=description"; for description

And send to PHP script

On php script side get it:

$option = $_POST['option'];

And output accordingly

If($option == 'image'){
//do something
} else if($option == 'quantity'){
//do something  
} else if($option == 'desription'){
//do something
}


Cheers,
Rufat


-Original Message-
From: cocoa-dev-bounces+rufataa=agbank...@lists.apple.com 
[mailto:cocoa-dev-bounces+rufataa=agbank...@lists.apple.com] On Behalf Of 
douglas chanco
Sent: Monday, September 20, 2010 9:32 PM
To: cocoa-dev@lists.apple.com
Subject: php and cocoa

For those on the xcode mailing list I am not spamming or anything but on one of 
these lists xcode or cocoa, someone posted a link with an example of getting 
data from a php web page into objective-c

The responses I got on the xcode list while useful is not what I am looking 
for.  What I am beginning to look at is an app that will send a http request to 
a php page and display the results (an image, description and qty)

I plan to have a php page that will return (depending on what it received)

1. a link to a image (or the actual image) I am still thinking this out
2. a single numeric value (quantity available)
3. a description of the item (a string)

any advice or the above mentioned link would be greatly appriciated

thanks

dougc



___

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/rufataa%40agbank.az

This email sent to rufa...@agbank.az
___

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