Re: Open panel is permanently dead?

2010-02-19 Thread Henry McGilton (Boulevardier)

On Feb 19, 2010, at 6:17 AM, Tom Davie wrote:

 Hi,
 
 I'm having some problems with an open panel.  I display the panel, allow the
 user to chose and image, and then do some work, which involves showing a
 sheet while the work is done.  This all works wonderfully, until the user
 clicks the set texture button again, and my method is called again.  The
 second time, for some reason, the open panel is never displayed.
 
 Can anyone tell what's going on here?  I've added code below:

SWAG here:  check the value of   isReleasedWhenClosed.   If it's YES, that 
would explain the panel
being dead after the first time.

Consider using  orderOut  to dismiss the panel instead of close.

Cheers,
. . . . . . . .Henry

 
 - (IBAction)setTexture:(id)sender{
   NSOpenPanel 
 http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSOpenPanel.html
 *panel = [NSOpenPanel
 http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSOpenPanel.html
 openPanel];
   
   [panel setCanChooseFiles:YES];
   [panel setCanChooseDirectories:NO];
   [panel setResolvesAliases:YES];
   [panel setAllowsMultipleSelection:NO];
   [panel setTitle:@Select Texture];
   [panel setAllowedFileTypes:[NSArray
 http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSArray.html
 arrayWithObject:@png]];
   [panel beginSheetModalForWindow:[delegate windowForSheet]
 completionHandler:^(NSInteger result)
   {
if (result == NSFileHandlingPanelOKButton)
{
NSURL 
 http://developer.apple.com/documentation/Cocoa/Reference/Foundation/ObjC_classic/Classes/NSURL.html
 *selection = [[panel URLs] objectAtIndex:0];
NSImage 
 http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSImage.html
 *image = [[[NSImage
 http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSImage.html
 alloc] initWithContentsOfURL:selection] autorelease];
   
[self.item addObserver:self 
 forKeyPath:@textureIsCompressed
 options:NSKeyValueObservingOptionNew context:nil];
self.item.texture = image;
   
[panel close];
   
[NSApp beginSheet:compressingTexturePanel
   modalForWindow:[delegate windowForSheet]
modalDelegate:self
   
 didEndSelector:@selector(compressionSheetDidEnd:)
  contextInfo:nil];
[compressingProgress startAnimation:self];
}
   }];}
 
 Thanks
 
 Tom Davie
 ___
 
 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/appledeveloper%40trilithon.com
 
 This email sent to appledevelo...@trilithon.com

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Puppeting/Automating one application from another?

2010-02-16 Thread Henry McGilton (Boulevardier)

On Feb 16, 2010, at 6:31 PM, James Trankelson wrote:

 Hi,
 
 I'm trying to figure out the general feasibility of the following task.
 
 Imagine I have two separate applications, running side by side. Is it
 possible to take all of the mouse/keyboard inputs that are going into
 one of these applications, and send them to the other in a way that
 would allow me to 'control' the other app from the events generated in
 the first? I took a few steps to begin creating an infrastructure to
 support this, but then became concerned that I'd soon have issues with
 focusing, like if pressing buttons in the 'puppeted' application would
 take away the focus in the application sending the events.
 
 Does anyone know if something like this is possible? If so, does
 anyone know of any applications that do this, or have any pointers
 that could help me with this?

The first thought off the top of my head was NSDistributedNotificationCenter.

Should be possible to flange up a mini-application to test the idea . . .

Cheers,
. . . . . . . .Henry

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: How to get small UISegmentedControl?

2010-02-13 Thread Henry McGilton (Boulevardier)

On Feb 13, 2010, at 11:39 AM, Laurent Daudelin wrote:

 Is there anyway to have smaller segmented controls besides the large ones 
 available in IB? I'm talking the size of the one in Settings-General for 
 Location Services. Any idea?


Using Interface Builder's Attributes Inspector, set the style to Bar.
There's a pull-down named Style right at the top of the inspector,
with choices of Plain, Bordered, or Bar . . .

If you're doing it programmatically, do a
  
[yourControl setSegmentedControlStyle: UISegmentedControlStyleBar];


Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Crash while drawing cell in NSOutlineView

2010-02-13 Thread Henry McGilton (Boulevardier)

On Feb 13, 2010, at 7:57 PM, Trygve Inda wrote:

 Trygve Inda (cocoa...@xericdesign.com) on 2010-02-14 22:13 said:
 
 In code based largely on Apple's SourceView, I am drawing by IconAndTextCell
 and getting a crash...
 
 Anyone seen this and know what it might be?
 
 I have added code to draw a badge which I am updating frequently - if I only
 call it once, it works ok... But if it is called rapidly I get:
 
 Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
 0   libobjc.A.dylib   0x7fff818ab120 objc_msgSend + 44
 
 Have you read this?
 
 http://www.sealiesoftware.com/blog/archive/2008/09/22/
 objc_explain_So_you_crashed_in_objc_msgSend.html
 
 Sean
 
 --
 It is difficult to get a man to understand something when his salary
 depends upon him not understanding it. - Upton Sinclair
 
 
 
 Most excellent!
 
 Thank you for this reference... As obviously I had not come across it.
 
 Maybe I will get to do some non-work this Saturday night.
 

One bit caught my eye immediately:

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib   0x7fff818ab120 objc_msgSend + 44
1   com.apple.CoreFoundation  0x7fff867ac246
_CFAutoreleasePoolPop + 230 
  
2   com.apple.AppKit  0x7fff81a69d3d -[NSTableView
drawRow:clipRect:] + 1343
3   com.apple.AppKit  0x7fff81a695cb -[NSTableView

Possibly something got released that should not have been released ?

Cheers,
. . . . . . . .Henry



=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Connected Objects being allocated

2010-02-12 Thread Henry McGilton (Boulevardier)

On Feb 12, 2010, at 1:31 PM, Donald Klett wrote:

 Once again, I am not understanding some aspect of Objective C and/or Cocoa.
 
 I created a simple class that contains two NSTextField objects.  I used IB to 
 connect the Controller object with the two text fields.  The code follows.  
 This example runs correctly and does copy the value from one text field to 
 the other.
 
 #import Cocoa/Cocoa.h
 
 @interface Controller : NSObject {
   IBOutlet NSTextField*   textField;
   IBOutlet NSTextField*   copyField;
 }
 
 - (IBAction) buttonTarget: (id) sender;
 
 @end
 
 #import Controller.h
 
 @implementation Controller
 
 - (IBAction) buttonTarget: (id) sender {
   int textValue;
   
   textValue = [textField intValue];
   [copyField setIntegerValue:textValue];
 }
 
 @end

Okay, all is groovy so far.What you've left unstated in the explanation 
above is that the
two text fields must have been allocated *somewhere*.I can make a SWAG that 
you
dragged a couple of text fields from IB's palette onto the (content view) of 
the main window
that shows up when you open MainMenu.xib, yes ?

If that is the case, you have two (instantiated and correctly * initialised by 
IB) text fields that
you can connect to from your (presumably also instantiated and initialised by 
IB) Controller
object.


 Now if I extend this to two objects (Controller and View), the resulting code 
 does not execute correctly.  Again, I used IB to connect the View object to 
 the two text fields.  Using the debugger I find that the two NSTextField 
 objects have not been allocated (both have nil values).  The code follows:

 
 #import Cocoa/Cocoa.h
 #import View.h
 

Minor detail here.Use @class forward references in .h files instead
of importing the class's .h file in your Controller's .h file.In other 
words,
delete the#import View.h   line and add a   @class  View;line . . .

This tells the compiler you'll be referencing the View class in your .h file
with an unspoken promise you will include the  View.h  file in your 
Controller's  .m
file . . .

 @interface Controller : NSObject {
 
   View*   view;
 }
 
 - (IBAction) buttonTarget: (id) sender;
 
 @end

 
 #import Controller.h
 #import View.h
 
 @implementation Controller
 
 - (id) init {
   if (self = [super init]) {
   view = [[View alloc] init];
   }
   return self;
 }

Below, you have  View  as a sub-class of NSObject.Why?
If View is supposed to be a sub-class of NSView, your [[View alloc] init]
above needs to be [[View alloc] initWithFrame: . . .]
 
 - (IBAction) buttonTarget: (id) sender {
   [view copyFieldValue];
 }
 
 @end
 
 #import Cocoa/Cocoa.h
 
 @interface View : NSObject {
 
   IBOutlet NSTextField*   textField;
   IBOutlet NSTextField*   copyField;
   
 }
 
 - (void) copyFieldValue;
 
 @end

Based on this declaration, do you have a View object instantiated in your 
MainMenu.xib,
and did you then connect the two outlets to the two text fields from that 
already instantiated object?
If so, after then instantiating a View object in your Controller, your 
Controller is now talking to
the wrong View object and the one from the xib is being ignored . . .

 
 #import View.h
 
 
 @implementation View
 
 - (void) copyFieldValue {
   [copyField setIntegerValue:[textField intValue]];
 }
 
 @end
 
 I have no idea what I am doing wrong.  Any help would be most appreciated.  
 Thanks in advance.

I hope this helps a little. One of the more common beginner mistakes
is to instantiate an object in the xib, and then instantiate a completely
new version in code . . .

And as (I think) someone already pointed out, if you have a class whose
name is View, anybody reading your code superficially would expect it to
*be* something that relates to existing NSView or UIView classes and have 
View-like behaviour . . .

A useful exercise to do is to look at your xib objects and draw a picture of
the objects and their connections --- that essentially defines your 'Application
Architecture', and a picture can quickly show up anomalies in the object
graph --- either orphan objects as I suspect in the case, or objects that aren't
really doing anything useful . . .

Cheers,
 . . . . . . . .Henry



=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: UINavigationController inside a TabBarController

2010-02-12 Thread Henry McGilton (Boulevardier)

On Feb 12, 2010, at 8:34 PM, Laurent Daudelin wrote:

 I'm not sure what I'm missing but I know it must be big. I started the design 
 of a TabBar-style app and now, I want one of the view to be a navigation one. 
 I did drag a UINavigationController to my xib, put it inside the TabBarView 
 and put my tableview under the navigation controller. When I open the window 
 in IB, I can see my tableview inside the nav controller, in the first tab 
 item but when I compile and go, only the navigation view shows up when I 
 select the tab item. I've been banging my head, trying to find what 
 connection or method I missed, I can't find it.

Your Navigation Controller must be one of the controllers in the Tab Bar
Controller's array of View Controllers.

Then, the Navigation Controller's Root View Controller must be the 
Table View Controller.

Is that the structure you have?

Possibly there is either a class identity that has not been correctly set,
or, there might be a Nib Name that is not correctly set.This stuff is 
notoriously
easy to get wrong . . .

In IB's List View inspector, go through each of the Tab Bar's list of View
Controllers.Make sure their Class identities are the correct type of View
Controller, and make sure that their NIB names (if appropriate) are
correct.


In a simple experiment, I dragged a Tab Bar Controller into a XIB.
I deleted one of the (two) View Controllers from the Tab Bar Controller.
Then I dragged a Navigation Controller into the XIB, and moved it into
the Tab Bar Controller's hierarchy.But the Navigation Controller's 
Root View Controller's class identity shows up as a simple UIViewController.
I had to select that and specifically set its identity to UITableView 
Controller.

Hope This Helps a Little . . .

Cheers,
. . . . . . . .Henry



 

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: What classes have -init?

2010-02-10 Thread Henry McGilton (Boulevardier)

On Feb 10, 2010, at 12:23 PM, James Walker wrote:

 I think at times I've written things like [[NSMutableArray alloc] init] with 
 no apparent ill effects, but now I notice that the docs for NSMutableArray 
 and NSArray don't say that there is an init method.  The NSObject docs say 
 that an init method might raise an exception.  Is there some other init rule 
 that I've missed, or have I just gotten lucky?

When in doubt, remember to look at the super-class documentation:

http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/doc/uid/2050-init

All classes that inherit from NSObject (which means pretty much
all of them) inherit NSObject's   –init   method, and that's assumed
or implicit in the Array examples you referenced above . . .

Cheers,
. . . . . . . .Henry



=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Strange UIImageView error

2010-02-07 Thread Henry McGilton (Boulevardier)

On Feb 7, 2010, at 4:33 PM, Development wrote:

 I am adding an image to a UIImageView and every time that I try to I get this 
 error: Error: invalid distance too far back\n
 
 and only about the top 10 lines of the image appear in the view, the rest is 
 black even though the image size is 
 correct.___



There's a possibility that error is coming from zlib when decompressing
whatever image you're using --- is it a PNG ?

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Strange UIImageView error

2010-02-07 Thread Henry McGilton (Boulevardier)

On Feb 7, 2010, at 5:53 PM, Development wrote:

 Yes it is a png and that makes sense since google only shows zlib errors when 
 I search it.

If whatever image editor you're using can be beaten into submission you might 
try fiddling 
with the interlace options and the compression options . . .Otherwise it 
might be a
corrupted image . . .

Cheers,
. . . . . . . .Henry

 
 On Feb 7, 2010, at 6:16 PM, Henry McGilton (Boulevardier) wrote:
 
 
 On Feb 7, 2010, at 4:33 PM, Development wrote:
 
 I am adding an image to a UIImageView and every time that I try to I get 
 this error: Error: invalid distance too far back\n
 
 and only about the top 10 lines of the image appear in the view, the rest 
 is black even though the image size is 
 correct.___
 
 
 
 There's a possibility that error is coming from zlib when decompressing
 whatever image you're using --- is it a PNG ?
 

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Dealing with rotten nibs

2010-02-06 Thread Henry McGilton (Boulevardier)

On Feb 6, 2010, at 9:57 AM, Matthew Weinstein wrote:

 It's associated with an NSDocument...
 
 On Feb 6, 2010, at 9:41 AM, edole...@gmail.com wrote:
 
 is it assoc with a view controller class?
 
 --
 Sent from the Verizon network using Mobile Email
 
 --Original Message--
 From: Matthew Weinstein mwein...@kent.edu
 To: cocoa-dev@lists.apple.com
 Date: Sat, Feb 6, 8:55 AM -0800
 Subject: Dealing with rotten nibs
 
 I have a very large nib file that lately has refused to make any
 connections. I can cntrl-click and get the wire but the other end is
 refused by all objects. Nothing seems to allow connections either
 interface elements or objects; outlets or actions...
 
 Has anyone run into this, and any fixes?

Well, as a very first, silly, simple test, check the class identity of the
whatever it is . . .

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Touch: Non-rectangular Touch areas

2010-02-06 Thread Henry McGilton (Boulevardier)

On Feb 6, 2010, at 11:28 AM, Paul Sanders wrote:

 Perhaps you could use separate images and convert them to 
 monochrome, saving them as 1 bpp bitmaps (aka masks).  Memory 
 should not then be an issue.
 
 Paul Sanders.
 
 - Original Message - 
 From: Andrew Farmer andf...@gmail.com
 To: Jens Alfke j...@mooseyard.com
 Cc: cocoa-dev@lists.apple.com
 Sent: Saturday, February 06, 2010 7:19 PM
 Subject: Re: Touch: Non-rectangular Touch areas
 
 
 Another simple approach is to use an image to do hit testing. 
 You can either create a bitmap image for each touchable area, or 
 a single image with a different color for each target, then test 
 the color at the target point to determine membership. My only 
 concern with using this approach on iPhone might be the memory 
 usage of that image. 

You could consider representing each of your trapezoids (or, for
that matter, any arbitrary shape) via a CGPath object, and then use
CGPathContainsPoint
for your hit testing . . .

Cheers,
. . . . . . . .Henry




=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Touch: Non-rectangular Touch areas

2010-02-06 Thread Henry McGilton (Boulevardier)


On Feb 6, 2010, at 3:45 PM, Development wrote:

 I really like the sound of this solution. I've never worked with CGPaths, is 
 that anything at all like NSBezierPath?

Conceptually similar, in that a CGPath is the Core Graphics analogue of 
NSBezierPath.
Just like NSBezierPath, you can create essentially any kind of vector-based 
shape that
can be described by a series of move-to-point, line-to-point, arcs, 
arc-to-point, cubic Bézier
curve, and Quadratic Bézier curve . . .

 because it seems like this might be the way to go. Can I use an Image to 
 create a CGPath?

From the subject of your original question I drew a plausible but potentially 
wrong
assumption that the 'Touch' refers to iPhone touches, hence the suggestion to 
use
CGPaths instead of NSBezierPath.

From that assumption I made another one, namely, that somewhere you have
specifications of the shapes of your trapezoids, and that such specifications 
could
then be used as the basis for CGPath objects.   So where are the trapezoids 
coming
from?Are they simply arbitrary random images with no underlying vector 
specifications?

If you have specifications, there might not be any need for images at all, or, 
if images are
actually required for whatever reason, they could additionally be manufactured 
on the fly
by drawing into Core Graphics Image Contexts . . .

Maybe clarify the problem specification a little . . .

Cheers,
. . . . . . . .Henry




 
 
 On Feb 6, 2010, at 2:44 PM, Henry McGilton (Boulevardier) wrote:
 
 
 On Feb 6, 2010, at 11:28 AM, Paul Sanders wrote:
 
 Perhaps you could use separate images and convert them to 
 monochrome, saving them as 1 bpp bitmaps (aka masks).  Memory 
 should not then be an issue.
 
 Paul Sanders.
 
 - Original Message - 
 From: Andrew Farmer andf...@gmail.com
 To: Jens Alfke j...@mooseyard.com
 Cc: cocoa-dev@lists.apple.com
 Sent: Saturday, February 06, 2010 7:19 PM
 Subject: Re: Touch: Non-rectangular Touch areas
 
 
 Another simple approach is to use an image to do hit testing. 
 You can either create a bitmap image for each touchable area, or 
 a single image with a different color for each target, then test 
 the color at the target point to determine membership. My only 
 concern with using this approach on iPhone might be the memory 
 usage of that image. 
 
 You could consider representing each of your trapezoids (or, for
 that matter, any arbitrary shape) via a CGPath object, and then use
   CGPathContainsPoint
 for your hit testing . . .
 
   Cheers,
   . . . . . . . .Henry
 
 
 
 
 =
 iPhone App Development and Developer Education . . .
   Visit  www.nonatomic-retain.com
 
 Mac OSX Application Development, Plus a Great Deal More . . .
   Visit  www.trilithon.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/development%40fornextsoft.com
 
 This email sent to developm...@fornextsoft.com
 

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Touch: Non-rectangular Touch areas

2010-02-06 Thread Henry McGilton (Boulevardier)

On Feb 6, 2010, at 6:45 PM, Kyle Sluder wrote:

 On Sat, Feb 6, 2010 at 3:45 PM, Development developm...@fornextsoft.com 
 wrote:
 I really like the sound of this solution. I've never worked with CGPaths, is 
 that anything at all like NSBezierPath?
 because it seems like this might be the way to go. Can I use an Image to 
 create a CGPath?
 
 No. This seems to be backwards, anyway. It sounds like you already
 know the pattern of tessellated trapezoids you need to use as your hit
 regions. Why not just do the math yourself? Trapezoids are convex
 polygons, and are fairly easy to triangulate.

Well, that too . . .If you're going the 'Do It Yourself' route, a fantastic
resource is the Wild Magic Geometric Tools web site here:

http://www.geometrictools.com/index.html

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Showing a menu after a delay...?

2010-02-01 Thread Henry McGilton (Boulevardier)

On Feb 1, 2010, at 2:11 PM, Eric Gorr wrote:

 Strange, I just replied to Richard saying that my selector is not performed 
 until after the mouse button goes up. I can hold the mouse button down for 
 several seconds and not see the selector performed.
 
 Of course, this may actually be due to the fact that my core event loop is 
 based around ReceiveNextEvent rather then a pure Cocoa event loop. Perhaps 
 that is what is interfering
 
 Might be headed to DTS for this one...

Well, the documentation does say:

This function tries to fetch the next event of a specified type. If no events 
in the event queue match, this function will run the current event loop until 
an event that matches arrives, or the timeout expires. Except for timers 
firing, your application is blocked waiting for events to arrive when inside 
this function.

Cheers,
. . . . . . . .Henry

 
 
 
 
 On Feb 1, 2010, at 5:05 PM, Gustavo Pizano wrote:
 
 Eric Hi, What Richar said its what Im actually doing to achieve such a 
 behaviour, using the performSelectorAfterDelay, will be your best shot but 
 what I do is that if the mouse goes up you just call the the NSObject method 
 cancelPreviousPerformRequestsWithTarget. then the selector will not be 
 performed.
 
 Hope it helps
 
 Gustavo
 
 On Feb 1, 2010, at 10:44 PM, Richard Penwell wrote:
 
 An alternative technique would be roughly:
 
 1. Detect mouse down, set state down
 2. Call performSelectorAfterDelay 1 second with a test method
 3. If the mouse goes up, set state up
 4. In the test method, test if the state is down...
 
 On Feb 1, 2010, at 4:42 PM, Eric Gorr wrote:
 
 What I am trying to accomplish is displaying a menu (perhaps with 
 NSPopUpButtonCell's performClickWithFrame method) after a user clicks on a 
 sublass of NSButton and holds the left mouse button for = 1 second.
 
 Is anyone aware of any sample code doing this?
 
 I imagine I will need to customize the mouseDown method of NSButton with a 
 loop that checks to see if the mouse button is still down. However, I am 
 uncertain how to determine this. I have seen NSEvent's pressedMouseButtons 
 method, but it only became available with the 10.6 SDK and I need 
 something that works with 10.5.
 
 I am also thinking that I may be taking the wrong approach, so any 
 suggestions on what approach I should be taking would be appreciated.
 
 Thank you.___
 
 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/almightylinuxgod%40me.com
 
 This email sent to almightylinux...@me.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/gustavxcodepicora%40gmail.com
 
 This email sent to gustavxcodepic...@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/appledeveloper%40trilithon.com
 
 This email sent to appledevelo...@trilithon.com

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: How to enable/disable a UITextField or UITextView programmatically?

2010-01-13 Thread Henry McGilton (Boulevardier)

On Jan 13, 2010, at 6:22 PM, William Squires wrote:

 I have a UITableView that's part of a Navigation-based Application. There's 
 one .xib, a DrinkDetailViewController class (.m  .h files) and an 
 AddDrinkViewController class which inherits from DrinkDetailViewController. 
 Both share the same view, which contains a UITextField, two UITextViews, and 
 some UILabels. The DrinkDetailViewController.h declares three IBOutlets as 
 follows:
 
 #import UIKit/UIKit.h
 
 @interface DrinkDetailViewController : UIViewController
 {
 IBOutlet UITextField *nameField;
 IBOutlet UITextView *ingredientsView;
 IBOutlet UITextView *directionsView;
 ...
 }
 
 @end
 
 so that I can access the UITextField, and the two UITextViews. IB shows in 
 the inspector window, that the UITextField, and UITextViews have a BOOL 
 enabled property (controlled by a checkbox labeled Enabled). But the 
 following doesn't work:
 
 ...
 nameField.enabled = YES;
 ingredientsView.enabled = YES;
 directionsView.enabled = YES;
 ...
 
 in the viewDidLoad: method of AddDrinkViewController. I unchecked the enabled 
 box for these controls as the normal use of the view is just to display drink 
 information, not for data entry. The AddDrinkViewController re-uses the view 
 for data entry, and I want to re-enable the fields, but only when the view 
 (xib) is used/loaded by the AddDrinkViewController. I looked in the docs for 
 UITextField, but didn't even see a reference to an enabled property. Is this 
 another of those view-within-a-view problems?

Theenabledproperty is defined in UIControl --- the super-class of 
UITextField . . .

This is a good time for a plug for Xcode's incredibly useful but oft skipped 
over Class Browser,
the second item in Xcode's  Project  menu . . .

Cheers,
. . . . . . . .Henry



=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: iPhone: validate a NSString for US zipcode

2010-01-07 Thread Henry McGilton (Boulevardier)

On Jan 7, 2010, at 8:53 AM, Eric E. Dolecki wrote:

 I don't care about the city, just that the zip code will work. On an iPhone
 testing against an array of 42,305 values... could that be pretty quick?
 Seems like a large set to go through looking. I'm sending the value to a
 webservice to return weather data.

Time to read about Binary Search --- for a list that size you can find (or not) 
a
match in just 16 comparisons . . . 

Cheers,
. . . . . . . .Henry


 
 On Thu, Jan 7, 2010 at 11:45 AM, Paul Bruneau paul_brun...@special-lite.com
 wrote:
 
 I'm a little unclear what you are asking, but I'll tell what I know. You
 just want to know if a 5 digit zip code is a valid one? Or do you want to
 compare it to the list of valid city names that are assigned to it? (yes it
 can be more than one, ugh)
 
 They are (from a non-USPS point of view) arbitrarily assigned by the post
 office and there are currently 42,305 or so assigned (out of a theoretical
 maximum of 100,000 of course)
 
 So assuming you just want to know if it's a valid zip (and don't care about
 if they got the city right), the only way to validate it solely from within
 your app as a valid zip code would be to have a list of them in your app.
 
 You could load them from a plist or straight text I guess into an NSArray
 or NSSet and then check to see if the zip is valid as needed.
 
 You can get the list from a third party service like
 http://www.zipcodeworld.com/ or maybe from some free source.
 
 The value of this might be questionable, since a zip code with a typo still
 has roughly a 50% chance of being a valid one. Plus the USPS is always
 adding new ones, so will you risk telling your user that his zip code
 doesn't exist when he is standing in it?
 
 So I guess the answer is there is no Cocoa technology that can help with
 this--unless you are asking something completely different, in which case
 let's all have a good chuckle at my poor comprehension skills :)
 
 
 On Jan 7, 2010, at 11:11 AM, Eric E. Dolecki wrote:
 
 I've been googling but haven't seen yet how to best validate a 5-digit
 zipcode for use in the US (without using a webservice).
 
 I have the NSString, I just need to validate it. I know zero RegExp, is
 there a formatter I can use?
 
 

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: NSBitMapImageRep Woes

2010-01-06 Thread Henry McGilton (Boulevardier)

On Jan 6, 2010, at 9:21 AM, David Blanton wrote:

 Here is the code:
 
 @interface MyDocumentView : NSView {
 @public
   
   NSBitmapImageRep*   m_NSBitmapImageRep;
   NSRect  m_frameRect;
   float   m_sz;
   BBitmap m_bitmap;
   unsigned char*  m_ptrs[1];
 }
 
 - (void)awakeFromNib {
   
   m_ptrs[0] = (unsigned char*)m_bitmap.m_array;
   m_NSBitmapImageRep = [[NSBitmapImageRep alloc]
  
 initWithBitmapDataPlanes:m_ptrs
  
 pixelsWide:m_frameRect.size.width
  
 pixelsHigh:m_frameRect.size.height
  bitsPerSample:8
  samplesPerPixel:4
  hasAlpha:YES
  isPlanar:NO
  
 colorSpaceName:NSCalibratedRGBColorSpace
  
 bitmapFormat:NSAlphaFirstBitmapFormat
  bytesPerRow:(4 * 
 m_frameRect.size.width)
  bitsPerPixel:32];
 }

Two questions:

1.where ism_frameRectinitialised ?

2.and are the width and height initialised to the precise number of  bits 
per row and number of rows
of whatever m_ptrs[0] is pointing at ?

3.(I said previously I can't count), are there potential endian issues 
involved ? 


 
 - (void)drawRect:(NSRect)dirtyRect {
   
   [NSGraphicsContext saveGraphicsState];  
   [m_NSBitmapImageRep drawInRect:dirtyRect];  
   [NSGraphicsContext restoreGraphicsState];
 }
 
 m_bitmap.m_array is created in readFromData:ofType:fromFile
 
 I know it is correct because if I use this code I get proper results:(in this 
 case bitmap is a local var but is generated just m_bitmap is.
 
   context = CGBitmapContextCreate (bitmap.m_array, bitmap.m_pixelsx, 
 bitmap.m_pixelsy, 8, bitmap.m_pixelsx * 4, colorSpace, 
 kCGImageAlphaNoneSkipFirst|kCGBitmapByteOrder32Host); 
   CGImageRelease(_cgImageRef);
   _cgImageRef =  CGBitmapContextCreateImage (context);
   CGImageRetain(_cgImageRef); 
   CGContextRelease(context);
   CGColorSpaceRelease(colorSpace);
 
 
 The problem is I just see garbage, no image.  Clearly I am doing something 
 wrong with the NSBitMapImageRep but I have no idea what.
 
 Please comment!
 



=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: NSDate without time portion

2010-01-05 Thread Henry McGilton (Boulevardier)

On Jan 5, 2010, at 1:43 PM, mmalc Crawford wrote:

 
 On Jan 5, 2010, at 1:35 pm, Kyle Sluder wrote:
 
 On Tue, Jan 5, 2010 at 1:23 PM, mmalc Crawford mmalc_li...@me.com wrote:
 An NSDate object represent a single point in time -- you can think of it 
 basically as a wrapper for an NSTimeInterval from the reference date.  If 
 you want to create components from the date, then you must do so with 
 respect to a particular calendar *and time zone*...  This is of course 
 possible, but then you have to be careful about always using the same 
 combination of calendar and time zone to create the components and recreate 
 the date from the components.
 
 I believe that Quincey's argument is that it is conceptually
 inaccurate in most cases to think of a point in time as simply an
 interval from a reference date. I agree that in contexts where words
 like today are meaningful, he's probably right. Especially in
 calendaring/scheduling apps. Given the number of people who struggle
 with the concept of daylight saving time, I am not surprised that I
 have yet to meet a non-technical person who could conceptualize a
 point in time independently of a calendar system.
 
 I'm not sure what the point is here, though?
 It's the job of the application to present to the user a representation of a 
 date that they can understand. It's the job of the programmer to interpret 
 that unambiguously such that it can be stored and recreated -- which is the 
 issue here. Talking about date components in the abstract as if any date can 
 arbitrarily be reduced to a collection of components without reference to any 
 other context (the calendar and time zone) is misleading.


For more fun with calendars, Wall(et) Street Journal had a nice article
yesterday:

http://online.wsj.com/article/SB126212850216209527.html

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: iPhone Creating a months view

2010-01-04 Thread Henry McGilton (Boulevardier)

On Jan 4, 2010, at 11:17 AM, Nick Zitzmann wrote:

 
 On Jan 4, 2010, at 11:35 AM, Eric E. Dolecki wrote:
 
 I am creating an iPhone view that has 12 months of views in it starting with
 January.
 
 Don't make assumptions about calendars unless you are absolutely sure you can 
 get away with them, e.g. every calendar currently in use in the world uses 
 seven day weeks. In this case, you shouldn't, because, for example, while 
 it's true that most calendar types have exactly 12 months in a year, the 
 Hebrew calendar has 12 months in a regular year and 13 months in a leap year. 
 You can use NSCalendar to figure out how many months there are in a given 
 year.
 
 For each subview (month) I need to get the 1st day of the month (which
 calendar day it falls on as an int). For instance Jan 2010 begins on a
 Friday (int of 5 I assume).
 
 Again, use NSCalendar and NSDateComponents. They are available on the iPhone 
 OS; the older NSCalendarDate class is not available on the iPhone OS.

As a follow-on to Nick's caveats above, check out NSLocale Calendar Keys
in the NSLocale Class Reference for a list of calendars supported on the phone.
Note that the phone-supported calendars are a subset of those supported on Mac 
OS X.

And NSCalendarDate appears to have vanished from Mac OS X Foundation as well . 
. .

Amateur and Professional calendar scholars alike can visit this web site for
everything you never wanted to know about calendar lore:

http://emr.cs.iit.edu/home/reingold/calendar-book/index.shtml


Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: NSImage

2009-12-31 Thread Henry McGilton (Boulevardier)

On Dec 31, 2009, at 2:26 PM, David Blanton wrote:

 Given an array of color data (a generic bitmap) what is the best / fastest / 
 recommended method to convert this to an NSImage?

Load your data into memory, create an NSBitmapImageRep from that pile of
data, then make an NSImage from the NSBitmapImageRep . . .

Cheers,
. . . . . . . .Henry



=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Knowing mouse pressed time?

2009-12-30 Thread Henry McGilton (Boulevardier)

On Dec 30, 2009, at 2:53 AM, slasktrattena...@gmail.com wrote:

 Simple. Start a timer on mouse down, invalidate it on mouse up.
 Something like this (written in mail):
 
 NSTimer *timer;
 
 -(void)mouseDown:(NSEvent*)ev
 {
timer=[[[NSTimer alloc] blah ...] retain];
 }
 
 -(void)mouseUp:(NSEvent*)ev
 {
   if ( [timer isValid] ) {
   [timer invalidate];
   [timer release];
   timer = nil;
} else {
 // perform single-click action
}
 }
 
 -(void)performHoldAction:(NSTimer*)tmr
 {
   // pop up menu
 }

Not to 'invalidate' your suggestion, but why not simply ask the appropriate
event objects for their timestamps ?Or did I overlook something in the
original question ?

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Knowing mouse pressed time?

2009-12-30 Thread Henry McGilton (Boulevardier)

On Dec 30, 2009, at 11:43 AM, Gustavo Pizano wrote:

 Henry hi.
 You mean with the NEEvent method that returns the timestamp?... I was trying 
 that also, and as far as I understood its the timestamp between the App 
 startup and the event...  so I dunno how this might help me... maybe I 
 misunderstood the API doc?
 
 To clarify the original question, what I want to achieve is something similar 
 to 10.6 dock, when you press the mouse on an icon, after a second or so, the 
 menu appears.  I dunno if this is what you understood.. I hope its better 
 explained now. :P 

Sorry I did not intend the thread to get into a deep discussion on the relative 
merits
of how to do things, nor, as I said, to invalidate Fabian's idea.

I meant that rather than setting a timer and implementing a callback method and
remembering to invalidate the timer, and so on and so on, you can do something
like this (which took less time to implement than the time required to explain 
it . . . ):

- (void)mouseDown:(NSEvent *)theEvent
{
NSLog(@mouseDown);
[self setStartStamp: [theEvent timestamp]];
}

- (void)mouseUp:(NSEvent *)theEvent
{
NSLog(@mouseUp);
NSTimeInterval  endStamp = [theEvent timestamp];
NSLog(@time difference = %.2f, endStamp - [self startStamp]);
}

where   startStamp   is an instance variable that records the timestamp on 
mouse down.
Then on mouse up, you grab the timestamp of the mouseUp's event and take the 
difference 
between the two timestamps . . 

Yes, the event's timestamp is the time since system startup (which I interpret 
to mean the time
since last reboot), but that doesn't really matter --- all you're concerned 
about is the
difference in time between mouse down and mouse up . . .

Interesting that I just recently implemented something like this for the iphone 
for similar
reasons, namely, to decide whether to show the Cut/Copy/Paste menu . . .

Hope that clarifies what I meant.

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Updating tracking areas Rect

2009-12-28 Thread Henry McGilton (Boulevardier)

On Dec 28, 2009, at 3:27 PM, Graham Cox wrote:

 
 On 29/12/2009, at 4:00 AM, Joar Wingfors wrote:
 
 NSInteger i = 0;
 while ([[self trackingAreas] count]==0) {
 [self removeTrackingArea:[[self trackingAreas] 
 objectAtIndex:i]];
 i++;
 }
 
 
 That loop seems all kinds of wrong...   ;-)
 
 How about:
 
  for (NSTrackingArea *trackingArea in [self trackingAreas]) {
  [self removeTrackingArea:trackingArea];
  }
 
 
 Wouldn't this fall foul of the usual problem with deleting items from the 
 collection being iterated, in that it will skip every other object? (Or 
 perhaps fast enumeration has a built-in protection against that?)

Yes, fast enumeration specifically states:

Enumeration is “safe”—the enumerator has a mutation guard so that if you 
attempt to modify the collection during enumeration, an exception is raised.
And also:

Since mutation of the object during iteration is forbidden, you can 
perform multiple enumerations concurrently.

 
 The first loop is also wrong in that its terminating condition is backwards 
 (should be 0) as well as having the skip every other object problem. If you 
 want to remove items from the collection being iterated, you should copy the 
 collection temporarily and iterate that or iterate it by index backwards.
 



Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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


[iPhone] NSKeyedArchiver with NSValue Objects

2009-12-24 Thread Henry McGilton (Boulevardier)

I bashed into a problem with NSKeyedArchiver trying to encode
NSValue objects.

I am using NSValue to wrap up CGPoint and CGSize structures, then 
doing an  encodeObject:  forKey:  to encode the NSValue.

I get this message:

[NSKeyedArchiver encodeValueOfObjCType:at:]: this archiver cannot encode 
structs'

I poked around in CocoaBuilder and Google for some definitive answers, but
the discussions appear to be mostly froth. This seems a little strange, as 
UIKit
provides a bunch of NSValue additions to encode those CG structs, but the 
NSKeyedArchiver can't encode them. And the message is somewhat misleading:
I'm encoding the NSValue object, not the structure . . .I'm assuming (I 
know, one
should never assume) that the NSValue object is invoking that   
encodeValueOfObjCType:at:
message . . .

I'd like to get some clarification or definitive answers on what's going on . . 
.
The available discussions I was able to find were not very helpful . . .

In the meantime, for anybody else tripping over this, I worked around it by

encodeObject: NSStringFromCGPoint(point)  forKey: locationKey

Cheers,
. . . . . . . .Henry

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Core Data Anomaly?

2009-12-23 Thread Henry McGilton (Boulevardier)

On Dec 23, 2009, at 7:41 PM, Richard Somers wrote:

 In my application when I do the following something strange happens.
 
 Add a managed object to the store, save the file, then save the file as 
 another name.
 
 Upon saving the file with another name, core data will create and then 
 destroy some kind of transitory shadow object of the same kind as the one in 
 the store.
 
 Is this normal?



Just a wild guess --- are you saving atomically ?When writing NSData 
objects, as one 
example, you can write to file atomically, in which case the object is written 
to a backup file
which is renamed if the write succeeds.The idea is that the write either 
succeeds or fails,
but nothing in between that would leave a corrupted file . . .

Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: Inspect Core Graphics Object

2009-12-22 Thread Henry McGilton (Boulevardier)

On Dec 22, 2009, at 9:33 AM, Richard Somers wrote:

 How do you inspect or print the description of a Core Graphics object?

There's no analogue to the  -description  method of Objective-C frameworks.

Many of the specific Core Graphics types like CGColor and CGColorSpace and
CGImage and CGFont have various 'Get . . .' function calls that provide sundry 
information about 
the object (CGColorGetComponents on CGColor, for instance).For CGPath, 
there's
a CGPathApply by which you can play back the elements of the path, and so on.   
 You
have to look at the stuff on a case-by-case basis . . .

   Cheers,
   . . . . . . . .Henry


iPhone App Developer Education --- visit  www.nonatomic-retain.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: UIImage and shadows, WAS: Re: Please if some one knows

2009-12-21 Thread Henry McGilton (Boulevardier)

On Dec 21, 2009, at 8:02 PM, Development wrote:

 Then I don't understand how to do this.
 
 Do I create the context at this larger size? because that's what I did.
 Do I drawInRect the image at it's original size? Because that's what I did. 
 
 As near as I can tell, no matter what I do, the image itself, not accounting 
 for the shadow, is drawn in the upper left corner. this causes a negative 
 shadow, or one to the upper left, to be cut off by the edge of the context. 
 I have attempted using drawAtPoint, and accounting for the negative shadow by 
 moving the point an amount that should accommodate the shadow. It did not 
 work.
 
 Now if the shadow is to the lower right, the adjustments I make work 
 perfectly every time and the shadow is exactly what it should be. 
 
 I think the point is that I do not understand the context drawing. I thought 
 I did but it should be painfully obvious from this thread that I do not.

Are you aware that the  context you get from   UIGraphicsBeginImageContext  has 
its origin
at upper left ?

In any case, I have posted a mini example that *appears* to do what you want, 
but based
on the descriptions, I might have misunderstood, in which case please excuse me 
for
wasting bandwidth . . .

The project is here:

http://www.trilithon.com/download/Shadow.zip

Cheers,
. . . . . . . .Henry


 
 
 
 
 On Dec 21, 2009, at 8:45 PM, Graham Cox wrote:
 
 
 On 22/12/2009, at 1:49 PM, Development wrote:
 
 however what I am getting now is a larger image, offset in the view and 
 still cutting off the shadow. So I honestly do not know how I am suppose to 
 draw this shadow. I would really be grateful for some additional direction.
 
 
 Try thinking instead of flailing about throwing code at it.
 
 You need a bigger image to accommodate the shadow. But the image you want to 
 composite on top is the same size as it always was. So you need to keep its 
 original size around so you can draw it at that size but into the larger 
 image context. If you draw it at the new size you are back at square one, 
 but larger.
 
 --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/appledeveloper%40trilithon.com
 
 This email sent to appledevelo...@trilithon.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: double free error

2009-12-14 Thread Henry McGilton (Boulevardier)

On Dec 14, 2009, at 12:45 PM, Eric E. Dolecki wrote:

 I was receiving malloc double free errors when a view removed itself, so all
 of the releases I was doing in the view I commented out, the view killing
 itself after it animates from visual view:
 
 - (void) killMe:(NSString *)animationID finished:(NSNumber *)finished
 context:(void *)context {
 
 [self.view removeFromSuperview];
 
 }


removeFromSuperview
Unlinks the receiver from its superview and its window, and removes it from the 
responder chain.

- (void)removeFromSuperview

Discussion
If the receiver’s superview is not nil, this method releases the receiver.

===
If you plan to reuse the view, be sure to retain it before calling this method 
and be sure to release it as appropriate when you are done with it or after 
adding it to another view hierarchy.

===


 I no longer receive the malloc double free errors. I was creating NSStrings
 and NSDateFormatters (init type stuff), all of which I previously was
 releasing myself. Does it sound reasonable that the removeFromSuperview was
 cleaning all that up already and thus the releases caused the errors? I am
 trying to still get my head around memory management.

Cheers,
. . . . . . . .Henry



___

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: Hang Initializing App

2009-12-11 Thread Henry McGilton (Boulevardier)

On Dec 10, 2009, at 4:51 PM, Joe Programmer wrote:

 I made a similar post to the Xcode list originally, but it was suggested that 
 I redirect it to the Cocoa list.  Here it is:
 
 I'm working with a Cocoa app compiling with gcc 4.0 in Xcode 3.2.1.  Both the 
 debug and the release builds launch fine from the Finder, but the app does 
 not launch through the debugger in Xcode.  The app's icon appears in the doc, 
 but the app just hangs in the debugger.
 
 This app was debugging fine under Xcode 2.5 and 10.5.x.  However, I had to 
 update the code in countless places to get it to build in 3.2.1 and 10.6.  
 Backing out those changes to discover the cause is something I'd like to 
 avoid if possible.  I made some changes to resources, but I *think* I was 
 able to back them all out with the error still occurring.
 
 Two occurrences of this massage are appearing in the console:
 
 -[NSCFArray _getCString:maxLength:encoding:]: unrecognized selector sent to 
 instance 0x4016e0
 
 In a reply to my Xcode list post, From the method signature, it looks like 
 the message should have been sent to an instance of NSString, rather than 
 NSArray, but the leading underscore indicates it is an internal method and 
 might indicate some 'class cluster' trickery going on behind the scenes.  I 
 would concur.

H --- I would not concur.Here's a potential cause:  The ' fingerprint ' 
of the error you are seeing occurs 
when an object has been over-released.Let's say that in this case the 
object in question was an NSString.
Somehow, well, because of a mistaken over-release, the memory that was 
previously occupied by the now
deallocated NSString is now occupied by an NSArray (NSCFArray).   The code then 
sends an NSString message
via an object reference that was once pointing to an NSString but is now 
pointing to an NSArray . . .

 
 With my limited knowledge of Cocoa, viewing the call stack does not reveal 
 the cause of this problem.
 
 #00x92fad4e6 in objc_exception_throw
 #10x92a0790b in -[NSObject(NSObject) doesNotRecognizeSelector:]
 #20x92962db6 in ___forwarding___
 #30x92962982 in __forwarding_prep_0___
 #40x9291bc53 in CFStringGetCString
 #50x930a4990 in _RegisterApplication
 #60x930a3182 in GetCurrentProcess
 #70x908e2071 in GetSystemUIMode
 #80x908e2013 in IsMenuBarVisible
 #90x93991092 in _NSInitializeAppContext
 #10   0x9399094c in -[NSApplication init]
 #11   0x93990485 in +[NSApplication sharedApplication]
 #12   0x9398f45d in NSApplicationMain
 #13   0x2f6e in main at main.m:42
 
 Occasionally, I am able to continue stepping/breaking  through model and 
 controller init code beyond the two breaks at objc_exception_throw, but never 
 consistently, probably because memory is trashed.
 
 Might anyone offer any insight as to what might be going on and/or where to 
 go from here?

If you can run Clang (via Build and Analyse), it might help pinpoint potential 
trouble spots.
But it also sounds as if you are fairly close to homing in on it based on what 
you just said about
stepping through the code.

Cheers,
. . . . . . . .Henry



___

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: [COCOA] notification of enter/focus event?

2009-12-11 Thread Henry McGilton (Boulevardier)

On Dec 11, 2009, at 10:23 AM, Paxton Sanders wrote:

 Sorry if this is a bit too basic, but...
 
 I want to know when the user exits edit fields, so I can check values and 
 provide immediate feedback.  I'm using
 - (void)controlTextDidEndEditing:(NSNotification *)aNotification
 and it works.
 
 I also need to know when a user enters an edit field, so I can provide 
 feedback (like a hint).  I was using
 - (void)controlTextDidBeginEditing:(NSNotification *)aNotification
 but it only works when the user types something.
 
 My question is this: how can I get notification when a user simply enters a 
 field by tabbing to it or mouse-clicking in it (and gives focus to that 
 field)?

How about  -becomeFirstResponder ?

Cheers,
. . . . . . . .Henry


___

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: Bug with IB?

2009-12-10 Thread Henry McGilton (Boulevardier)

On Dec 10, 2009, at 6:24 AM, Eric E. Dolecki wrote:

 If I create a UILabel in IB in a view  I place 1/2 of the label out of the
 view at the top, I can't seem to drag the view window around by the title
 bar where the label is. I know that having the control 1/2 out of the view
 isn't normal, but shouldn't the view window move around regardless of where
 I click on the window's title bar?


Not necessarily --- if you just happen to click in the little IB icon in the 
window
title bar, you'll start a drag of that icon . . .

I just tried your experiment --- that is, place a UILabel halfway up out of the 
view
(essentially 'under' the title bar), and I'm able to drag the window/view around
with no problem at all *providing* I start the drag outside of the little IB 
icon . . .

Cheers,
. . . . . . . .Henry


___

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: Unable to write in InfoPlist.strings file from cpp

2009-12-10 Thread Henry McGilton (Boulevardier)

On Dec 10, 2009, at 8:42 AM, Manfred Schwind wrote:

 Be careful, though: Some MacOS versions have a bug where .strings files had 
 to be UTF16 to actually work. I don't think Apple has fixed that yet.
 
 Do you have more specific information about that?
 I consequently always used UTF-8 for all my .strings files in every project I 
 ever worked on (for many years; I think I started with 10.1 or so) and never 
 had a single problem with that.
 What exactly does not work when not using UTF-16?
 Maybe UTF-16 and UTF-8 both work, but - of course - no other encoding like 
 ISO Latin or Mac Roman etc.?


There is a very much in passing comment in  'Internationalising Programming 
Topics'  guide for Cocoa.

Note: It is recommended that you save strings files using the UTF-16 
encoding,
which is the default encoding for standard strings files. It is 
possible to create strings
files using other property-list formats, including binary property-list 
formats and XML
formats that use the UTF-8 encoding, but doing so is not recommended . 
. .

Cheers,
. . . . . . . .Henry

___

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: Question about touchesBegan

2009-12-09 Thread Henry McGilton (Boulevardier)

On Dec 9, 2009, at 5:58 PM, Eric E. Dolecki wrote:

 Is there a way to define the touchesBegan in an added sub view to
 be constricted to a certain area and not allObjects? Thus leaving a hole
 to allow touches to be fired on the view below?

If I interpret your question correctly, you want the added sub-view to NOT 
handle touches?

If so, don't implement the touchesBegan/Moved/Ended methods in that sub-view.

Alternatively, simply disable user interaction for that sub-view.

Even more alternatively, I have found in many cases that handling touches in 
the View Controller
that manages the view hierarchy makes life easier.You receive a touch and 
simply ask what
view it landed in.


Cheers,
. . . . . . . .Henry




___

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: dynamic NSPointArray allocation

2009-11-28 Thread Henry McGilton (Boulevardier)

On Nov 28, 2009, at 2:50 PM, Quincey Morris wrote:

 On Nov 27, 2009, at 14:58, Shane wrote:
 
 I think I'm understanding this in part ...
 
 // *.h
  NSMutableData *pointData;
  NSPointArray *points;
 
 // *.m
  pointData = [[NSMutableData alloc] init];
 
  ...
 
  NSPoint point = NSMakePoint([iters floatValue], [mse floatValue]);
  // not sure how to get an NSPoint into NSMutableData?
 
  // here I resize NSMutableData, but this will always only be
  // increasing the length by 1.
  [pointData increaseLenghtBy:sizeof(NSPoint)];
 
  // and here I assign the data to NSPointArray
  points = (NSPoint *) [pointData bytes];
 
 And from here I can pass this NSPointArray around till I get to the
 point where I will use this data for my NSBezierPath. Will
 NSBezierPath (which takes an NSPointArray) be able to properly read
 from 'points' by doing the above?
 
 In part, but not quite. Although Graham's advice was good, and might be a 
 better approach, for completeness here's how this approach works.
 
 You only need one instance variable:
 
   NSMutableData *pointData;
 
 which you can initialize as above.
 
 To add a point, I'd do something like this:
 
   NSUInteger pointCount = [pointData length] / sizeof (NSPoint);
   [pointData setLength: (pointCount  + 1) * sizeof (NSPoint)];
   NSPointArray points = [pointData mutableBytes];
   points [pointCount] = somePoint;
 
 To add the points to a Bezier path:
 
   [somePath appendBezierPathWithPoints: [pointData mutableBytes] count: 
 [pointData length] / sizeof (NSPoint)];
 
 Note:
 
 1. 'NSPointArray*' isn't the correct type for an array of points. Plain 
 'NSPointArray' is what you want.
 
 2. You will get a compiler warning if you try to assign [pointData bytes] to 
 the NSPointArray variable, because the [point bytes] is of type 'const 
 void*'. You need [pointData mutableBytes] which is just of type 'void*'.
 
 3. There's no need to cast [point mutableBytes] to NSPointArray because 
 there's no warning assigning from 'void*' to a compatible pointer type. 
 Casting it is not wrong, but any time you write an explicit cast, you're 
 overriding much of the compiler's type checking, so it's easy to introduce 
 bugs that way. (Not likely in this case, but as a general consideration.) 
 It's a personal thing, though -- I guess some people like to have the 
 explicit cast because it documents what the code is supposed to be doing.

Another possible approach is simply use a NSMutableArray full of NSValue 
objects that contain
the NSPoint structures . . .

Cheers,
. . . . . . . .Henry


___

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: Custom Controls Where to start

2009-11-27 Thread Henry McGilton (Boulevardier)

On Nov 26, 2009, at 4:01 PM, Sandro Noël wrote:

 Thank you Alastair.
 
 Well it's pretty complicated, This is my third application, the first being 
 Bonjour Mounter, the Second RDP Launcher.
 Others were created but never released. I've always used the OS's controls 
 but now I find myself frustrated 
 with the limits of these controls in terms of looks. I see other application 
 makers producing great looking 
 applications with custom looking views and controls.
 
 So I want to be able to know where to start and what to think about when I 
 create a control, a view.
 I did venture to read the Doc documentation, there is much there but so much 
 it becomes confusing.
 
 for example, the look of the segment control does not fit the look that i'd 
 like it to have, i find it's a good enough starting point 
 to create a tab bar, a little like Safari, and add the close tab button and 
 some status information on the right end of the tab.
 along with a scrolling title like on the Apple TV.
 
 From what I understand, all I would have to do is create my own cell.
 
 Also, the controls for the HUD panels are missing, there is 
 BWHUDAppKit.framework that does partial of the work witch is amazing.
 but it is not complete, i like to use the CollectionView control, and it hans 
 not been implemented, so i'm off to do it myself.
 there are also table cels missing, i would like to create those too.
 
 I think that once I've done these I would pretty much be able to create my 
 own out of this world looking controls while preserving HIG intact.
 and it will also give me a better understanding of the underpinnings of cocoa.

You might want to check out BWToolkit:


http://www.brandonwalkin.com/bwtoolkit/___

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: CATransition for whole windows?

2009-11-23 Thread Henry McGilton (Boulevardier)

On Nov 23, 2009, at 10:33 AM, PCWiz wrote:

 What I had in mind was a window vanishing effect for when the window is 
 closed (for example a fade out is easy to do with [[window animator] 
 setAlphaValue:0.0];) but something slightly more complex, such as the private 
 suckEffect transition that CATransition offers.
 
 On 2009-11-23, at 11:02 AM, Matt Neuburg wrote:
 
 On Mon, 23 Nov 2009 10:32:24 -0700, PCWiz pcwiz.supp...@gmail.com said:
 CATransition can be used to animate views, but is there a way to
 animate complete windows (NSWindow's or NSPanel's)?
 
 Animate *what* about a complete window? If you mean what's *in* the window,
 that *is* a view (the window's contentView). If you mean make the window
 dance around the screen somehow, please don't. ) m.


For those interested I've posted a view simple quick and dirty Window
animation that shrinks the window down to effectively zero, and can
then expand it back to its original state.Use the View menu Flip item
to see.

http://www.trilithon.com/download/FlipWindow.zip


Cheers,
. . . . . . . .Henry


___

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

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

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

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


Problem With Setting Badge via Interface Builder

2009-11-22 Thread Henry McGilton (Boulevardier)
I wonder if anybody else has seen this particular end case.
I googled for anything remotely like this problem and found nothing really
relevant, and CocoBuilder is down right now.

In a group learning situation last week, one of the people stumbled over a
problem defining and then trying to un-define a Tab Bar Item Badge using
Interface Builder.The scenario is this:

We started with a Window-based Application (having decided the Xcode Tab
Bar iPhone Application template is too confusing --- That's not necessarily 
germane to the discussion to follow).

First thing is to drag a Tab Bar Controller object into MainWindow.xib.

You change the view of MainWindow.xib to List View, so you can fiddle
around making the various View Controllers have the correct class
identities and do other stuff . . .

One of the group was exploring, selected the Tab Bar Item, saw the Badge
property, thought, 'This could be useful', and set the Badge value to some
number (let's say 5) . . .The Tab Bar Item dutifully displayed  a nice badge
with the number 5 inside. 

Having seen that, he then selected the Badge text field and deleted the text.

But, the badge itself stays around, just does not display any content.In 
other
words, a blank badge.

Given that the default value of the Tab Bar Item's Badge property is nil, I
surmise that setting that property to *anything* via Interface Builder will
then create an NSString.At that point, even if one deletes the text in the
text field, the badge property is then/still displaying a zero-length NSString.

Using Interface Builder, the only solution appears to be to delete the Tab
Bar Item and re-create it, which, while likely taking only a minute or so to
set up everything and establish correct class identity and such , seems a
little akin to swatting mosquitoes with sledge-hammers . . .

The other approach is to grab the Tab Bar items in the App Delegate and
set all their badge properties to nil.   Of course that means one needs to
be aware of which items actually *want to* be badged . . .

I'd like to know if anybody else has stumbled over this one.

Cheers,
. . . . . . . .Henry




___

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: question about informal protocols

2009-11-22 Thread Henry McGilton (Boulevardier)

On Nov 20, 2009, at 12:22 PM, Jens Alfke wrote:

 
 On Nov 20, 2009, at 12:09 PM, Michael de Haan wrote:
 
 Does the, in your opinion, optional addition pretty much replace 
 categories as a whole, or is there still a role for them?
 
 It replaces informal protocols. There are many other uses for categories, like
 
 * Breaking a class implementation across several source files
 * Declaring private/internal class methods that a few other classes are 
 allowed to call
 * Declaring some of a class's methods in other headers (ones that only make 
 sense in the context of that other header)
 * Adding methods to a pre-existing framework class

Not to overlook the all-important AppKit and UIKit 'Additions' to their 
respective Foundation Frameworks . . . 

Cheers,
. . . . . . . .Henry


___

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: UITextField in UITableView covered by keyboard

2009-10-24 Thread Henry McGilton (Boulevardier)


On Oct 23, 2009, at 10:29 AM, Bob Barnes wrote:


Hi all,

  I posted this a yesterday, but it never appeared on the list and  
it's not showing up in the web archive so I thought I'd retry.


 I have a UITableView that contains some cells with UITextField's  
embedded in them. When I touch the UITextField to begin editing the  
keyboard pops up and obscures the the text field. I've been looking  
at the UICatalog sample, which has  a nearly identical setup and the  
UITextField scrolls up to make itself visible, but I've been unable  
to determine what it's doing to cause that. I've read suggestions on  
scrolling the UITexField rect, resizing the UITableView, etc., but  
UICatalog doesn't do any of that, yet still works. What am I missing?



You may also have to consider the scenario where the Table View Cell  
that contains the UITextField
is so close to the end of the Table View that it can not be scrolled  
up out of the way.  In the case, you
have to temporarily move the entire Table View upwards by adjusting  
its frame origin . . .


Best Wishes,
. . . . . . . .Henry


___

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: UITabBar UIActionSheet

2009-10-07 Thread Henry McGilton (Boulevardier)


On Oct 7, 2009, at 4:35 PM, Luke the Hiesterman wrote:

If you subclass UITabBar you can get the touches yourself and  
respond appropriately.


Luke


You can also set a delegate for the Tab Bar Controller and implement the
- (void)tabBarController:(UITabBarController *)tabBarController
   didSelectViewController:(UIViewController *)viewController

This method gets invoked even if you select an already selected  
tab . . .


Cheers,
. . . . . . . .Henry




On Oct 7, 2009, at 4:03 PM, Mark Bateman wrote:


Hi,

I have an app that uses a TabBarController and on certain of the  
tabbar items I want the user to be presented with a UIActionsheet  
even if the user presses the the same tab bar item that is  
currently selected.


I have tried the viewwillappear method and that works only if i  
select another icon first.


I also tried to use setneedsdisplay using the delegate method -  
(void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item

but this method never runs.

Any help would be appreciated

Mark.
___

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/luketheh%40apple.com

This email sent to luket...@apple.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/appledeveloper%40trilithon.com

This email sent to appledevelo...@trilithon.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: app delegate +initialize

2009-10-07 Thread Henry McGilton (Boulevardier)


On Oct 7, 2009, at 8:39 PM, John Baldwin wrote:

Perhaps that's what's tripping me up: bogus expectations. Here's  
what I have set up.


In the xib file, the File's Owner delegate is set to an  
AppController instance (an object in the xib).


The AppController has a +initialize method which initializes my user  
defaults.


Inside the xib is a window which is set to visible at launch. The  
error happens in the window controller for this window, which is  
expecting the user defaults to be initialized by the AppController  
instance.


So I'm expecting the AppController instance to be loaded and the  
+initialize method to be called before my window controller is  
loaded and its outlets start getting referenced.


John


The order of un-archiving from a NIB is un-defined . . .

Cheers,
. . . . . . . .Henry





On Wednesday Oct 7  10:48 AM, at 10:48 AM, Jens Alfke wrote:



On Oct 6, 2009, at 11:30 PM, John Baldwin wrote:

When the application crashes on launch, there is no record of the  
+initialize method being called. When the application launches  
successfully, there is a record of the +initialize method being  
called.


I haven't been following the whole thread, but are you assuming  
that all classes are initialized immediately when the process  
launches (similar to C++ static initializers)? Because that isn't  
the way it works. A class isn't initialized until the first time  
it's used — by creating an instance, calling a class method, or  
looking up the class by name.


So it's entirely possible that something unrelated to this class is  
causing a crash before that class ever gets referenced. Are you  
able to get a backtrace or crash log?


—Jens




___

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: Drawing a graph testing ranges

2009-09-15 Thread Henry McGilton (Boulevardier)


On Sep 15, 2009, at 5:20 AM, Graham Cox wrote:



On 15/09/2009, at 10:07 PM, Mark Bateman wrote:

if I have a value of   x= 10,000   y = 211.2 and an envelope  
of   9500, 200: 13000, 211:  14000,214: 9500,214 can i use  
NS range to check if the original coordinates are inside the  
bounds of that rectangle...


if not any ideas how i might do that...





NSPointInRect(...) or CGRectContainsPoint(...)



The way I usually do graph plotting is to normalise (usually the  
dependent variables) to the
height of the plot rectangle.  Presumably you don't want plot  
points to disappear simply

because they're larger than the size of the rectangle . . .

Cheers,
. . . . . . . . .Henry


___

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: coding NSNumber in NSArray?

2009-09-14 Thread Henry McGilton (Boulevardier)


On Sep 14, 2009, at 9:11 AM, jon wrote:

I thought i had read that NSNumber knew how to code itself in an  
NSArray...  is this not the case? or is this code below just set up  
all wrong?  and what would the proper way be  to set this up?


bookMarkNode's coders are below,   this object has the one  
NSNumber,  and two NSStrings


when i look in the debugger at allItems,   the NSNumber is not  
well defined.


thanks in advance,
Jon.


BookMarkNode *node1 = [[BookMarkNode alloc] init];
[node1 setTypeOfLeaf:[NSNumber numberWithInt:0]];
[node1 setNodeTitle:@eBay];
[node1 setURL:@http://www.ebay.com/;];

etc...

		NSArray *allItems = [NSArray arrayWithObjects: node1, ..etc  
nil];


[node1 release];


You're creating an auto-released NSNumber instance, and then releasing  
it.At a first guess,

it's over-released . . .


//  
---

- (NSArray*)mutableKeys
{
NSArray *tempKeys = [NSArray arrayWithObjects:
@typeOfLeaf,
@nodeTitle,
@urlString,
nil];

return tempKeys;
}
//  
---

- (id)initWithCoder:(NSCoder*)coder
{   
self = [self init];
NSEnumerator *keysToDecode = [[self mutableKeys] objectEnumerator];
NSString *key;
while (key = [keysToDecode nextObject])
[self setValue:[coder decodeObjectForKey:key] forKey:key];

return self;
}

//  
---

- (void)encodeWithCoder:(NSCoder*)coder
{   
NSEnumerator *keysToCode = [[self mutableKeys] objectEnumerator];
NSString *key;
while (key = [keysToCode nextObject])
[coder encodeObject:[self valueForKey:key] forKey:key];
}



___

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/appledeveloper%40trilithon.com

This email sent to appledevelo...@trilithon.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: Circular references

2009-09-13 Thread Henry McGilton (Boulevardier)


On Sep 13, 2009, at 4:17 PM, Kyle Sluder wrote:

We already know the cause and the solution: MyViewController.h  
imports MySubview.h, and MySubview.h imports MyViewController.h. The  
standard C header preprocessor trick does not help in this  
situation, and neither does import.


The solution is to use a forward declaration. For ObjC classes this  
looks like @class Foo;. For functions it's a prototype  
delcaration: int foo();. Structs are similar: struct foo;, and C+ 
+ classes follow suit: class Foo;.


In short, this is a well-known consequence of C requiring types to  
be defined before they're used.


--Kyle Sluder

On Sep 13, 2009, at 3:56 PM, Jay Reynolds Freeman jay_reynolds_free...@mac.com 
 wrote:


Unfortunately, #import seems not to be working in the case given;  
I don't know why.  The mechanism I suggested might be useful for  
chasing down why.


--  Jay Reynolds Freeman
-
jay_reynolds_free...@mac.com
http://web.mac.com/jay_reynolds_freeman (personal web site)


On Sep 13, 2009, at 3:41 PM, Kyle Sluder wrote:

This does not solve the problem at hand (two interfaces need a  
declaration of each other's symbols). The mechanism you describe is  
obsoleted by #import.


A potentially much simpler way of handling the job as well as getting  
rid of all the
incestuous connections is simply to handle the event processing in the  
View Controller.
View Controllers are Responders on both desktop and mobile  
platforms . . .


Cheers,
. . . . . . . .Henry

___

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: Drawing Text in an NSImage

2009-08-27 Thread Henry McGilton (Boulevardier)


On Aug 27, 2009, at 8:13 PM, Seth Willits wrote:



drawAtPoint/drawInRect in NSString/NSAttributedString says...

You should only invoke this method when an NSView object has focus.
Don’t invoke this method while no NSView is focused.


When an image is focused, and you draw text, it'll definitely do  
wonky things if the currently focused view is flipped. If we can't  
use these methods, are we really supposed to drop down to  
NSLayoutManager etc etc to draw a simple string? Is there really no  
secret API for image-friendly string drawing? Just want to double  
check before I have to go invent one...


Not quite sure what is the problem you're having here, Seth.

Create your NSImage.lockFocus on the image.Draw into the image.
i have two apps that draw into images using drawAtPoint, and I don't see
any problems relating to views . . .

Cheers,
. . . . . . . .  Henry



___

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: Drawing text into a UiView

2009-08-25 Thread Henry McGilton (Boulevardier)


On Aug 23, 2009, at 10:57 PM, J J wrote:

I'm trying to write an app that will page through text .. I'm trying  
to grab the text, find out how much with fit on a page, write the  
text to a view (page), then perhaps paginate the pages around it  
onto other views to be ready as needed.
Anyone have any ideas on how this would work ?  I'm having a hard  
time finding examples of writing text to a view directlyI'd love to  
do it via UIWebView, but not sure how I would know how big one page  
would be



Why would a UITextView not do the job?  UITextView is already a  
sub-class of UIScrollView,

so all the scrolling behaviour is done for you.

If you really need to 'roll your own', study the NSString UIKit  
Additions Reference API in UIKit.
That describes methods for fitting text into specified rectangles with  
specified fonts

and specified line-breaking modes . . .

Cheers,
. . . . . . . .Henry




___

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: [iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.

2009-08-09 Thread Henry McGilton (Boulevardier)


On Aug 8, 2009, at 1:23 AM, Brian Bruinewoud wrote:


Hi,

I'm a little confused about how this code works:

   MyController *myController = [[ myController alloc ]  
initWithNibName: @myView bundle: nil ];
   [[ self navigationController ] pushViewController:  
myController animated: YES ];

   myController.myProperty = itsValue;
   [ myController release ];

I always see the view set-up code (in this case  
myController.myProperty = itsValue) after the view has been  
displayed. It makes more sense to me to set up the view before  
calling pushViewController but this doesn't work. For example, if  
myProperty has a non-synthesized setter that expects IBOutlets to be  
bound it will be disappointed as they'll still be nil at this point.



So, my questions are:

Why doesn't initWithNibName create and bind all the IBOutlets before  
it returns?


Because --- as Kyle Sluder stated --- laziness is a virtue, in  
operating systems and in
programmers (but only if the latter use their laziness  
effectively) . . .


The iPhone programming frameworks have a very simple set of design  
concepts for displaying

data to the user of an iPhone application:

opresent data in single screens

oeach screen of presentable data is represented by a single UIView,
  which may have many associated sub-views (which fact is largely  
irrelevant)


othat single screen / single UIView is created and managed by a  
UIViewController


Initialisation of a UIViewController is done in one of two ways  
(skipping over details like the
different ways to initialise Navigation Controllers or Table View  
Controllers):


MyViewController  *aController = [[MyViewController alloc]  
init];


or

MyViewController  *aController = [[MyViewController alloc]  
initWithNibName: @MyViewNib  bundle: nil];


In both of these cases, all you have done is to allocate and  
initialise a View Controller.That's it.

No further work is being done behind the scenes by the View Controller.

In the first simple alloc-init style, the design assumption is that  
the View Controller will fabricate
its managed view 'manually' *when the View Controller is asked to do  
so* by referencing its view property.


In the second, initWithNibName style, the design assumption is that   
initWithNibName tells
the newly allocated View Controller the name of the NIB that it *will*  
load (in the future)
*when the View Controller is asked to do so* by referencing its view  
property.


So, . . .


Is the view guaranteed to be visible after pushViewController returns?


Absolutely not.All you have done by invoking  pushViewController   
is to push a

View Controller onto the Navigation Controller's stack . . .


Or is it still animating on another thread?


The question is meaningless . . .

Or is the request to display the view merely queued for the next  
loop through the RunLoop?


Likewise . . .

There's no need to bring threads and runloops into the picture (other  
than the regular old runloop
and the main thread where all this activity is likely taking  
place).There is a very very simple
sequence that's followed from application launch through to display of  
the initial screen by even

the most complex iPhone applications.

Given you have been talking about Navigation Controllers, the process  
of obtaining screens / views you
can interact with programmatically starts when some other part of the  
program (maybe your application
delegate or maybe some other View Controller) asks that Navigation  
Controller to supply its view and to place

that view onto the window in some fashion.

After that, the Navigation Controller will then ask the View  
Controller at the top of the Navigation stack
for *its* view, and then the View Controller your were asking about  
earlier will go through the correct
rituals to produce a screen / view of (one hopes) useful data for the  
end user.


Similar situation with the call to makeKeyAndVisible - I've seen  
samples of applicationDidFinishLaunching where makeKeyAndVisible is  
called and then set up is done to the main window's view.


I (and I am sure many others) would be highly interested to see these  
sample codes to which
you refer.In general, if you make the window visible first and  
then load up your initial screen
and add it to the window, the user will see a (possibly unpleasant)  
'flash' as the new stuff is added.
A more user-friendly approach is to (quickly) load the initial UI, add  
it to the window, and then

display the window.

I hope this has clarified some of the issues of View Controllers and  
Views . . .


Cheers,
. . . . . . . .Henry




___

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 

Re: NSMutableArray initWithCapacity and insertObject:atIndex

2009-08-09 Thread Henry McGilton (Boulevardier)


On Aug 9, 2009, at 9:59 PM, Adam Gerson wrote:


I would like to insert objects out of order into an NSMutableArray.

I create the array with

NSMutableArray* cards = [[NSMutableArray alloc] initWithCapacity:5];


initWithCapacity simply makes an array large enough to contain that  
number
of elements.initWithCapacity  is just a suggestion to the class  
that you might

want to start with that number of elements.


When I try to call

[cards insertObject:card atIndex:4];

I get the error:

*** -[NSCFArray insertObject:atIndex:]: index (4) beyond bounds (1)

Why doesn't this work?


Based on the initialisation code, you have an array capable of holding  
five elements
(with the potential for expanding as required), but that doesn't mean  
there are five elements
in the array.After that initialisation, there are zero ( 0 )  
elements in the array, and thus

any attempt to store beyond the last element will fail.

What you're apparently trying to do is have what's known as a 'sparse  
array'.Take a look
at the NSIndexSet class to see if it helps you get where you want to  
go . . ..


Another way to proceed (but for reasonably small arrays) would be to  
allocate an array of
some size and initialise all its elements with instances of NSNull. 
This idea would work only
in a limited universe of discourse --- clearly, if you wanted an  
element at 0 (zero) and

another at (in Snow Leopard) 2 ^64, you're in trouble.

Poke around on the web for sparse array implementation techniques . . .

Cheers,
. . . . . . . .Henry



___

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: [iPhone 3.0] UIImage startAnimating -- how to tell when it's finished?

2009-08-08 Thread Henry McGilton (Boulevardier)


On Aug 8, 2009, at 6:09 PM, John Michael Zorko wrote:



Hello, all ...

I load a UIImageView with an array of PNG images, and call  
startAnimating -- this works very well.  However, I need to know  
when the animation is done, because I need to have a thread load the  
next animation.  Unfortunately UIImageView doesn't implement the  
animationDidStop:finished method :-(


If anyone can give me some pointers on this, i'd appreciate it :-)



My first thought (but I have not had time to explore it) is to look at  
the

animation delegate stuff in UIView.There may be a possibility that
you can start your UIImageView animating, then set yourself as
the UIView's/UIImageView's animation delegate and implement the
method you specified for animationDidStopSelector . . .

Cheers,
. . . . . . . .Henry


___

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: where can I download xcode 3.2

2009-07-29 Thread Henry McGilton (Boulevardier)


On Jul 28, 2009, at 12:22 AM, Kyle Sluder wrote:


On Jul 27, 2009, at 10:38 AM, YongLi liyon...@gmail.com wrote:

I have installed the snow leopardbut i can't find the download link  
of xcode

3.2


1. This is cocoa-dev. This list exists for the discussion of Cocoa,  
not for downloading seeds or other non-Cocoa topics.


2. Snow Leopard and the developer tools are distributed under NDA  
and you therefore can't talk about them publicly. NDA forums can be  
found at http://devforums.apple.com.


3. All the downloads are in the same place: the Mac dev center at http://developer.apple.com 
.


True, all the downloads are in the same place as you said.However,  
the answer to the OP's
question can be found by carefully paying attention to the (publicly  
available PDF document) on

that very download site

iPhone SDK 3.0 (Snow Leopard) Read Me

Cheers,
. . . . . . . .Henry


___

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: Cahnging bgColor of a UIView not working.

2009-07-29 Thread Henry McGilton (Boulevardier)


On Jul 29, 2009, at 11:27 AM, Eric E. Dolecki wrote:


This is good to use:
#define UIColorFromRGB(rgbValue) [UIColor \ colorWithRed:((float) 
((rgbValue
 0xFF)  16))/255.0 \ green:((float)((rgbValue  0xFF00)   
8))/255.0

\ blue:((float)(rgbValue  0xFF))/255.0 alpha:1.0]

cell.textColor = UIColorFromRGB(0x33);

On Wed, Jul 29, 2009 at 1:04 PM, Brian Slick briansl...@mac.com  
wrote:



On Jul 29, 2009, at 12:56 PM, David Duncan wrote:

On Jul 29, 2009, at 4:52 AM, Brandon Walkin wrote:


The arguments to that UIColor method should be in the range of 0  
to 1.

Divide each RGB value by 255 to get them into that range.



This is more of a PSA than anything (because I've seen more than a  
fair
share of devs slap themselves on the head here too): Always ensure  
your
using floating point division if your going to do this. That means  
always
dividing by 255.0. I've seen too many people asking why do I  
always get

black and pointed out because you forgot the .0 :).
--
David Duncan
Apple DTS Animation and Printing


*jaw dropping*

Well, I guess that explains that.  I finally just gave up and did  
the math

myself.

Good tip, thanks!
Brian


What I've always wondered in this particular context of our color  
component specifications
ranging from 0.0 to 1.0 is why the System RGB color chooser displays  
the component
values in the range 0 to 255?   You'd think by now there'd be a  
'Developer Friendly'

version of the chooser . . .

Cheers,
. . . . . . . .Henry


___

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: Beginner Question Re: Memory Management

2009-06-22 Thread Henry McGilton (Boulevardier)


On Jun 22, 2009, at 1:39 PM, Daniel Torrey wrote:

I'm looking at some sample iPhone code, and in the app delegate's  
applicationDidFinishLaunching method, I see


// Set up the view controller
	MyViewController *aViewController = [[MyViewController alloc]  
initWithNibName:@HelloWorld bundle:[NSBundle mainBundle]];

self.myViewController = aViewController;
[aViewController release];

I'm a little confused - I see an allocation, followed by an  
assignment, followed by a release.  I think that the assignment is  
really a call to a setter - the myViewController field is created  
automagically using the @property/@synthesize syntax.


Look at the @property declaration for  myViewController  in the .h  
file.The likelihood is that there is a retain declared.

That means that when the setter method is invoked via the

self.myViewController = aViewController;

statement, a retain will be issued on the object during the  
assignment.That statement is essentially

equivalent to writing the old-fashioned way:

[self setMyViewController: aViewController];

Since a release was sent to aViewController, what keeps that object  
from being nuked at the end of the run loop?  There must be another  
retain happening somewhere, right?


Yes --- in the setter method, assuming the @property declaration  
declared it as retain.


The code you cite above is a common idiom intended to funnel instance  
variable accesses through their
proper accessor methods as opposed to accessing  instance variables  
directly.


Second question - is there anyway to see the code that gets  
generated by @synthesize?  I'm nosy and curious.


There's a few hints on how the accessors work (they work just fine,  
thank you) starting around page 50
of The Objective C 2.0 Programming Language document.In general,  
assume synthesised

accessor methods will Do The Right Thing . . .

Cheers,
. . . . . . . .Henry



___

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: NSInterger Infinity?

2009-06-18 Thread Henry McGilton (Boulevardier)


On Jun 18, 2009, at 10:39 AM, Chunk 1978 wrote:


agreed.  the reason i asked is because i saw this snippet of code:
repeatCount = 1e100f; and i just though that seems awfully ambiguous
and hoped for something a little more universal.


Nothing ambiguous at all --- it's about 2 * 10 ^ 82 times the current  
estimated age

of the Universe, and that ought to be Universal enough . . .



On Thu, Jun 18, 2009 at 1:35 PM, WTjrca...@gmail.com wrote:

On Jun 18, 2009, at 7:02 PM, Chunk 1978 wrote:


i would like to set an AnimationRepeatCount to loop continuously.
what is an appropriate number to set?


You could use NSIntegerMax. Although finite, it's so large it might  
as well
be considered infinitely large, in the context in question. I doubt  
any user
will be running your application continuously for a long enough  
period of

time to exhaust an entire animation cycle of that length.


___

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: Scaling an entire CGPath?

2009-04-22 Thread Henry McGilton (Boulevardier)


On Apr 22, 2009, at 11:25 AM, Maryanna Rogers wrote:


This path will never be drawn.

~m

On Wed, Apr 22, 2009 at 8:23 PM, David Duncan  
david.dun...@apple.com wrote:

On Apr 22, 2009, at 10:54 AM, Maryanna Rogers wrote:


I need to take a CGPath (a set of lines, curves, etc.) and scale the
entire thing as a whole. Is there a simple way to do this?

Do I need to use CGPathApply somehow?



Typically you would just scale the context that you are drawing the  
path

to...


Without further information as to what you're trying to accomplish, we  
can't see

what the real problem is.

Making some assumptions:

1.   If you are constructing the path yourself, surely simple  
multiplication of the
   path coordinates by the scale factor(s) prior to adding the  
specific element

   to the path should do the trick.

2.   If you have been handed a path and need to scale it, you can use  
a Path
  Applier function in conjunction with CGPathApply to play back  
each element
 of the path.See CGPathApply, CGPathApplierFunction, and  
CGPathElement

 for further details.

Cheers,
. . . . . . . .Henry


___

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