Re: NSControl Subclass and First Responder

2011-05-10 Thread Wood, Tobias C
For posterity, if anyone needs the answer to this, I discovered that I need to 
also over-ride needsPanelToBecomeKey to return YES so that a mouse-click can 
give focus to the control. I found this in the ClockControl example, I'd not 
seen that method before.
Toby

On 5 May 2011, at 23:40, Wood, Tobias C wrote:

> Hello,
> I am trying to create a simple NSControl sub-class that will respond to mouse 
> clicks and key presses, however I cannot get it to take First Responder 
> status despite having over-ridden acceptsFirstResponder to return YES. If I 
> place breakpoints in acceptsFirstResponder and becomeFirstResponder then 
> acceptsFirstResponder is called, returns YES, but becomeFirstResponder never 
> gets called and so the class never receives a keyDown message. Mouse-down 
> messages are received correctly. My current implementation is below, am I 
> missing something simple?
> Thanks in advance,
> Toby Wood
> 
> @implementation testControl
> + (Class)cellClass
> { return [NSActionCell class];}
> 
> - (BOOL)acceptsFirstResponder
> { return YES; }
> 
> - (BOOL)becomeFirstResponder
> {
>   [super becomeFirstResponder];
>   NSLog(@"Became first responder.");
>   return YES;
> }
> 
> - (void)drawRect:(NSRect)dirtyRect {
>   // Drawing code here.
>   NSRect bounds = [self bounds];
>   [[NSColor whiteColor] set];
>   [NSBezierPath fillRect:bounds];
> }
> 
> - (void)keyDown:(NSEvent *)theEvent
> { NSLog(@"Got a key.");   }
> 
> - (void)mouseDown:(NSEvent *)theEvent
> {
>   NSLog(@"Got a mouse down.");
>   [NSApp sendAction:[self action] to:[self target] from:self];
> }
> @end___
> 
> 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/t.wood07%40imperial.ac.uk
> 
> This email sent to t.woo...@imperial.ac.uk

___

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 NSClassFromString(@"CADisplayLink")?

2011-05-10 Thread Brian Bruinewoud
Hi All,

Just curious, why does this work (compiles and runs):

displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget: 
tapped selector:@selector(respond:)];

But this doesn't link because the CADisplayLink class is missing:

displayLink = [CADisplayLink   displayLinkWithTarget: 
tapped selector:@selector(respond:)];

??

Link error is:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_CADisplayLink", referenced from:
  objc-class-ref in drawingViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Using XCode 4.0 and the iPad simulator. I suppose if I compiled for ARM the 
error might go away (but I don't have provisioning profile so I can't test 
that). Still, the code still runs so it must be able to link at run time even 
if it can't at compile time, which seems strange.

Anyway, just curious.

Regards,
Brian.

___

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: transitionWithView:duration:options:animations:completion: still defeats me

2011-05-10 Thread Roland King

On 10-May-2011, at 3:12 AM, Matt Neuburg wrote:

> 
>> Date: Mon, 09 May 2011 21:43:38 +0800
>> From: Roland King 
>> Subject: transitionWithView:duration:options:animations:completion:
>>  still defeats me
>> 
>> I seem to have a lot of trouble with this method! A few months ago I had my 
>> own custom drawRect: and that was messing it up, this time I just have a 
>> simple UIView with some controls on it, nothing clever. One of the controls 
>> is given by the property 'complexity'. What I want is for my UIView to 
>> rotate and show up with/without that control. However whatever I have tried 
>> all that happens is the control instantly disappears or reappears, no 
>> transition at all. Here's the code ..
>> 
>>  [ UIView transitionWithView:factorsView 
>> duration:2.0f 
>>  options:( 
>> UIViewAnimationTransitionFlipFromRight | 
>> UIViewAnimationOptionAllowAnimatedContent )
>>   animations:^{ [ [ factorsView 
>> complexity] setHidden:![ [ factorsView complexity ] isHidden ] ]; } 
>>   completion:NULL 
>>   ];
>> 
>> factorsView is the UIView subclass and it's displayed and it's on screen.
>> 
>> I've tried with and without the AllowAnimatedContent option. The factorsView 
>> never rotates, it stays right where it is, and the complexity subview just 
>> winks in and out of existence. 
> 
> The key thing is to ask for the factorsView to be redrawn. Otherwise you're 
> not doing anything to it that can trigger animation. In other words, the 
> animation block should consist of [factorsView setNeedsDisplay].
> 
> http://www.apeth.com/iOSBook/ch17.html#_view_animation
> 
> m.

In this case it turned out to be something simpler. There's a difference 
between 'UIViewAnimationTransitionFlipFromRight' and 
'UIViewAnimationOptionTransitionFlipFromRight'. The former is for 
setAnimationTransition:forView:cache: the latter is for the 
transitionWithView:duration:options:animations:completion: method. The compiler 
doesn't tell one enum from another and neither it seems can my brain at 11pm. 
Switching to the correct constant everything worked. 

Thanks as ever - I like the look of your book by the way, nice examples and it 
all goes in a sensible order. ___

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: Why NSClassFromString(@"CADisplayLink")?

2011-05-10 Thread Hank Heijink (Mailinglists)
On May 10, 2011, at 6:34 AM, Brian Bruinewoud wrote:

> Hi All,
> 
> Just curious, why does this work (compiles and runs):
> 
>displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget: 
> tapped selector:@selector(respond:)];
> 
> But this doesn't link because the CADisplayLink class is missing:
> 
>displayLink = [CADisplayLink   displayLinkWithTarget: 
> tapped selector:@selector(respond:)];
> 
> ??

If the class is missing, NSClassFromString(@"CADisplayLink") returns nil. When 
you say that it "compiles and runs", does that mean that line of code puts a 
non-nil value in displayLink? That would be interesting, but I suspect you're 
just calling a method on nil.

Hank

___

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: IB 3x plug-in: How to add custom control which is NSMatrix with custom controls inside?

2011-05-10 Thread Laurent Daudelin
Open the view that contains the matrix in IB. Then, open the matrix. The first 
cell should be called "Prototype Button Cell (Radio)" or something like that. 
Select that prototype cell. Select "Tools -> Identity Inspector".  The class 
identity lets you select which class this cell should be.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

On May 10, 2011, at 03:41, Vyacheslav Karamov wrote:

> But the question is how to do it in IB.
> 
> 07-May-11 01:50, Lee Ann Rucker пишет:
>> On May 6, 2011, at 8:34 AM, Vyacheslav Karamov wrote:
>> 
>>> Hi All!
>>> 
>>> I have to support rather old project, so I had to rewrite IB 2x palette in 
>>> order to open project's NIBs.
>>> 
>>> In old IB 2x pallete code several instances of NSMatrix with custom 
>>> controls are created:
>>> 
>>> 
>>> I tried to embed several Library Object Templates (with custom controls 
>>> inside) into NSMatrix but I couldn't.
>>> 
>>> How to create such matrices in IB 3x plug-in?
>> NSMatrix can only contain cells.  You're putting CLButtonCells in when you 
>> create it in code; you have to do the same thing in IB.
>> 
>> Once you've created the matrix you can edit its Prototype Cell to use your 
>> custom class.

___

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: Why NSClassFromString(@"CADisplayLink")?

2011-05-10 Thread David Duncan
On May 10, 2011, at 3:34 AM, Brian Bruinewoud wrote:

> But this doesn't link because the CADisplayLink class is missing:
> 
>displayLink = [CADisplayLink   displayLinkWithTarget: 
> tapped selector:@selector(respond:)];
> 
> ??
> 
> Link error is:
> 
> Undefined symbols for architecture i386:
>  "_OBJC_CLASS_$_CADisplayLink", referenced from:
>  objc-class-ref in drawingViewController.o
> ld: symbol(s) not found for architecture i386
> collect2: ld returned 1 exit status


These types of link errors typically indicate that you forgot to link a 
necessary framework, in this case QuartzCore.framework.
--
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: setState has no effect on an NSButton

2011-05-10 Thread David Duncan
On May 9, 2011, at 9:55 PM, Graham Cox wrote:

> Why bother? Because it's more readable than all those if/else constructions, 
> and hence, less prone to bugs. Also, if( st == YES)...else if(st == NO) is 
> redundant - a BOOL can only be YES or NO. The optimiser might optimise away 
> the second comparison anyway, but why be windy in the first place?


A BOOL is just a typedef of an unsigned char, so technically it can hold any 
value from 0-255. It usually only holds 0 (NO) or 1 (YES) but this is not 
required and there is code out there that will happily return 2-255 expecting 
that you treat the value the same as YES.

Basically, YES is only useful as an assigned value, not as a comparison value. 
Code that compares against YES is typically not defensive enough in the face of 
other semi-badly behaved code. From a performance point of view, the compiler 
actually cannot optimize away the comparison to NO after the comparison to YES, 
because it cannot guarantee that the value you are comparing against isn't a 
value other than YES or NO in most cases.
--
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


Call NSView's -drawRect method manually

2011-05-10 Thread Nick
helloo. Can someone explain please, when an NSView's call -drawRect
(being called manually - not by a framework) actually initiates
redrawing of the frame and displaying everything that it had drawn,
and when this call "doesn't initiate a thing"?

in some Apple samples is see that often to display a movie (a set of
frames) onto the view this method is being called manually from the
display link that is a part of NSView.

When i am calling [myCustomView drawRect:NSZeroRect] from somewhere
else than NSView's subclass' implementation code (a display link is
not located inside NSView's subclass implementation) it doesn't work.
I am obliged to use [myCustomView setNeedsDisplay:YES] which requires
adding synchronization and the code becomes kind of messy.

Is there a way to call drawRect and make sure the view actually redraws itself?
Thanks.
___

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: Call NSView's -drawRect method manually

2011-05-10 Thread Nick
Thank you
But there is no way to call "drawRect" manually? Maybe to call it
manually and then tell NSView that it had processed that method?
I just found out why in Apple sample code CIVideoDemoGL drawRect could
be called directly - because the drawing job was delegated to the
OpenGL, and drawn by OpenGL. When it's done using Quartz2D, the direct
call of drawRect  doesn't work.
I needed that just to simplify code - that would allow me to avoid
synchronization (im getting a frame, calling drawRect and waiting till
it finishes - and can safely "reload" this buffer with a new picture).

Also i wanted to ask, if that is a wrong thing to do - to call [myView
display] from the displaylink, instead of waiting for its turn in
Event Loop's queue.

2011/5/10 koko :
> [myCustomView display]
>
> will call drawRect outside of normal run loop processing, i.e. it happens 
> right now.
>
>
>
>
> On May 10, 2011, at 10:26 AM, Nick wrote:
>
>> helloo. Can someone explain please, when an NSView's call -drawRect
>> (being called manually - not by a framework) actually initiates
>> redrawing of the frame and displaying everything that it had drawn,
>> and when this call "doesn't initiate a thing"?
>>
>> in some Apple samples is see that often to display a movie (a set of
>> frames) onto the view this method is being called manually from the
>> display link that is a part of NSView.
>>
>> When i am calling [myCustomView drawRect:NSZeroRect] from somewhere
>> else than NSView's subclass' implementation code (a display link is
>> not located inside NSView's subclass implementation) it doesn't work.
>> I am obliged to use [myCustomView setNeedsDisplay:YES] which requires
>> adding synchronization and the code becomes kind of messy.
>>
>> Is there a way to call drawRect and make sure the view actually redraws 
>> itself?
>> Thanks.
>> ___
>>
>> 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


Re: Call NSView's -drawRect method manually

2011-05-10 Thread Kyle Sluder
On Tue, May 10, 2011 at 9:45 AM, Nick  wrote:
> But there is no way to call "drawRect" manually? Maybe to call it
> manually and then tell NSView that it had processed that method?

Nope.

--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


Re: Why NSClassFromString(@"CADisplayLink")?

2011-05-10 Thread Wim Lewis

On 10 May 2011, at 3:34 AM, Brian Bruinewoud wrote:
> Just curious, why does this work (compiles and runs):
> 
>displayLink = [NSClassFromString(@"CADisplayLink") displayLinkWithTarget: 
> tapped selector:@selector(respond:)];
> 
> But this doesn't link because the CADisplayLink class is missing:
> 
>displayLink = [CADisplayLink displayLinkWithTarget: tapped 
> selector:@selector(respond:)];


Because the second one causes the linker to find the class in the frameworks 
you're actually linking against, but the first one searches the process at 
runtime for a class by that name. Unless you're prepared for 
NSClassFromString() to return Nil, you should use the second form (and supply 
the appropriate framework to the linker so that it can resolve the class 
reference to the specific class in that framework).

The first form works because something else in the process happens to have 
loaded something that refers to CADisplayLink, but there's no guarantee that 
that will be true.


___

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: Call NSView's -drawRect method manually

2011-05-10 Thread Guillem Palou
You may bypass the message queue by calling [theView display] but be
aware not to draw too many times.

Guillem

On 10/05/2011, at 18:59, Kyle Sluder  wrote:

> On Tue, May 10, 2011 at 9:45 AM, Nick  wrote:
>> But there is no way to call "drawRect" manually? Maybe to call it
>> manually and then tell NSView that it had processed that method?
>
> Nope.
>
> --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/guillem.palou%40gmail.com
>
> This email sent to guillem.pa...@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


Re: Call NSView's -drawRect method manually

2011-05-10 Thread Kyle Sluder
On Tue, May 10, 2011 at 10:31 AM, Guillem Palou  wrote:
> You may bypass the message queue by calling [theView display] but be
> aware not to draw too many times.

Rather than do this, it's better to learn how the framework actually
works, and behave accordingly.

Don't fight the framework.

--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


iOS Decode H.264 video frames

2011-05-10 Thread Andy Bell

Hi All,

I have a RTSP stream of H.264 video and I would like to decode the video 
stream.  I am aware of ffmpeg but I was wondering if there are any 
alternatives to decoding the stream on iOS 4.x


Thanks, Andy
___

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: Call NSView's -drawRect method manually

2011-05-10 Thread Ken Thomases
On May 10, 2011, at 11:26 AM, Nick wrote:

> Can someone explain please, when an NSView's call -drawRect
> (being called manually - not by a framework) actually initiates
> redrawing of the frame and displaying everything that it had drawn,
> and when this call "doesn't initiate a thing"?

When the framework calls your -drawRect: method, it has already established a 
graphics context and configured it as appropriate for the view.  If you just 
call it yourself, there's either no current graphics context or some arbitrary 
graphics context that isn't related to your view.

It's conceivable that one could manually set up the graphics context and then 
call -drawRect: oneself, but it's going to be complicated and error-prone.  It 
is not advised

Search the documentation for the -lockFocus... methods of NSView -- not just 
the class reference, but also the mentions of it in the View Programming Guide 
(the Advanced Custom View Tasks page) and the Threading Programming Guide (the 
Thread Safety Summary page).  That latter is especially important since you're 
working with a display link, which calls your callback on a secondary thread.  
It couldn't hurt to read about graphics contexts in the Quartz 2D Programming 
Guide and Cocoa Drawing Guide.

All of that said, you should always think twice about fighting the frameworks, 
as has been said by others.  Chances are you're doing something you shouldn't 
be or are making your life harder for no good reason.

Regards,
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


A long, convoluted path... made shorter?

2011-05-10 Thread William Squires
After using Xcode/Obj-C/Cocoa to make an iPhone project (a custom phone-book 
app for my employer), I've come to the following conclusion(s), and maybe some 
of you have, also:

1) There needs to be a way to 'wrap' the .h, .m, and .xib file all into one 
nice 'package' (a .xhm file, maybe?), though not all the parts would 
necessarily be in each 'package'; a formal protocol would only need a .h part, 
and a user-defined class (that's not an MVC 'view') would only need the .h and 
.m parts. It might even have a .html file for documentation, generated via 
doxygen or other tool. This could easily be distributed and sold to other Xcode 
users
2) A way for the .m files (generated by Xcode for views) to have all the stubs 
un-remmed out, but 'code-folded' so they'd be out of the way.
3) A way to create one's own 'code-folding' regions, like with VB.NET; maybe 
using #pragma mark and a (new) #pragma unmark?
4) Methods (in the .m) file appear heirarchically under their file (name) in 
the project pane via a disclosure triangle, and those with non-trivial code 
would appear in bold (i.e. like REALbasic) A stub (method declaration + '{' and 
'}' with or without comments) would appear in regular (non-bold) type.
5) Along with #1 above, a way to encrypt/decrypt the .m part so that the whole 
shebang could be sold to other developers without exposing the 
'how-does-it-work' underneath (unless they pay extra for the right to view the 
source!) There would be two encryption keys; one to unlock a 'read-only' mode, 
and another to unlock full 'read/write' capability. The .h part would be 
visible in any case; it wouldn't be encrypted.

___

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: A long, convoluted path... made shorter?

2011-05-10 Thread John Joyce

On May 10, 2011, at 8:26 PM, William Squires wrote:

> 5) Along with #1 above, a way to encrypt/decrypt the .m part so that the 
> whole shebang could be sold to other developers without exposing the 
> 'how-does-it-work' underneath (unless they pay extra for the right to view 
> the source!) There would be two encryption keys; one to unlock a 'read-only' 
> mode, and another to unlock full 'read/write' capability. The .h part would 
> be visible in any case; it wouldn't be encrypted.
This exists. Compile your code into a framework. Make private methods private. 
Include headers and 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


Re: A long, convoluted path... made shorter?

2011-05-10 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Most of this doesn't have anything to do with Cocoa so I will be brief
and respond only to the relevant portions.

On 5/10/11 6:26 PM, William Squires wrote:
> After using Xcode/Obj-C/Cocoa to make an iPhone project (a custom
> phone-book app for my employer), I've come to the following
> conclusion(s), and maybe some of you have, also:
> 
> 1) There needs to be a way to 'wrap' the .h, .m, and .xib file all
> into one nice 'package' (a .xhm file, maybe?), though not all the
> parts would necessarily be in each 'package'; a formal protocol would
> only need a .h part, and a user-defined class (that's not an MVC
> 'view') would only need the .h and .m parts. It might even have a
> .html file for documentation, generated via doxygen or other tool.
> This could easily be distributed and sold to other Xcode users

You just described a Framework.  The first sentence at
http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WhatAreFrameworks.html
is

"A framework is a hierarchical directory that encapsulates shared
resources, such as a dynamic shared library, nib files, image files,
localized strings, header files, and reference documentation in a single
package."

> 5) Along with #1 above, a way to encrypt/decrypt the .m part so that
> the whole shebang could be sold to other developers without exposing
> the 'how-does-it-work' underneath (unless they pay extra for the
> right to view the source!) There would be two encryption keys; one to
> unlock a 'read-only' mode, and another to unlock full 'read/write'
> capability. The .h part would be visible in any case; it wouldn't be
> encrypted.

Compile a library as part of the Framework (vide supra).  This is how
closed-source code is distributed.

I'm not sure what you mean by "read only" versus "read write"
encryption.  Seems to me that if you allow them to read the code then
you are implicitly allowing (from a technical, not legal standpoint)
them to copy and modify as well.  (Cf. any DRM scheme ever created.)



- -- 
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/

iD8DBQFNyeiaaOlrz5+0JdURAp8tAJ93dH23eXicJyDciaaS6uMeyBs00gCeNU1L
2IuSk8rNtUqP3p0zGBq6LJU=
=QmOx
-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


PDFDocument and CGPDFDocument

2011-05-10 Thread Graham Cox
Are CGPDFDocument and PDFDocument toll-free bridged? If not, how can I get a 
PDFDocument from a CGPDFDocumentRef? 

I need to use the lower level API to extract graphic entities from a PDF, but 
I'd like to use PDFKit up-front to implement a page chooser.

--Graham


___

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


What state does an iOS app retain after being quit that causes it to crash on relaunch?

2011-05-10 Thread G S
We have a network-dependent app that will suffer from lengthy delays if
connectivity is poor.  We've found that if the user quits the app during a
long network activity, the app will often crash upon its next launch.

Why?  It shouldn't be retaining any state between launches.

Thanks for any insight!
___

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 state does an iOS app retain after being quit that causes it to crash on relaunch?

2011-05-10 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 5/10/11 8:44 PM, G S wrote:
> We have a network-dependent app that will suffer from lengthy delays if
> connectivity is poor.  We've found that if the user quits the app during a
> long network activity, the app will often crash upon its next launch.
> 
> Why?  It shouldn't be retaining any state between launches.

On iOS >= 4 this is not true.  Even without explicitly opting into
multitasking (e.g. by declaring background operations, termination
handlers, etc.), on "quit" apps are not terminated but suspended (i.e.
state is kept in memory and restored when the app is relaunched).  The
app may still be terminated either by the user force-quitting it
(probably only power users do this) or if the operating system needs to
free up memory by purging apps that have been suspended for a while.

Your app delegate gets various notifications/messages that it can use to
perform appropriate actions at the various points in the life cycle, and
it sounds like you might need to do this.  These are discussed in detail
in the section "The Application Life Cycle" at
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/CoreApplication/CoreApplication.html.

In particular, you may want to examine:

–applicationDidEnterBackground:
–applicationWillEnterForeground:
–applicationWillTerminate:

Also note that, depending on what you are trying to do, it may make
sense to do some network actions as a background task that will continue
(for a time) even after the app is suspended; look into UIApplication's
- -beginBackgroundTaskWithExpirationHandler: method if you want to go down
this road.


- -- 
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/

iD8DBQFNyg00aOlrz5+0JdURAttpAJ92CfUEZggLr4JccnXlrryn1s0glwCffDvS
mgK1i7Zb1Ga0Mx+Pnf3mnLs=
=eFUl
-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: What state does an iOS app retain after being quit that causes it to crash on relaunch?

2011-05-10 Thread G S
Ah, that sounds vagely familiar now.  Thanks for the pointer, Conrad.
___

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 state does an iOS app retain after being quit that causes it to crash on relaunch?

2011-05-10 Thread Glenn L. Austin

On May 10, 2011, at 9:14 PM, Conrad Shultz wrote:

> Your app delegate gets various notifications/messages that it can use to
> perform appropriate actions at the various points in the life cycle, and
> it sounds like you might need to do this.  These are discussed in detail
> in the section "The Application Life Cycle" at
> http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iphoneosprogrammingguide/CoreApplication/CoreApplication.html.
> 
> In particular, you may want to examine:
> 
> –applicationDidEnterBackground:
> –applicationWillEnterForeground:
> –applicationWillTerminate:

And if you don't want to or can't put the handlers in the UIApplication 
delegate, you can just observe the UIApplication notifications themselves.

I do this a lot for stand-alone classes that need to cancel UI when the 
application goes into the background.


___

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