Re: iPhone/iPad device orientation problems
On Oct 13, 2010, at 7:16 PM, William Squires wrote: Hi What's the proper way to force an iOS device to set the orientation to one of UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown ? So what is the correct way of programmatically setting the interface orientation in iOS devices? In your UIViewController write something like this (example below is to force the app into landscape mode only): // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) { [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeLeft]; return YES; } else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) { [[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight]; return YES; } return NO; } ___ 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: UIButton variations?
On Oct 13, 2010, at 5:07 PM, Laurent Daudelin wrote: I was just wondering, given the single choice of a default UIButton (when compared to all the variations that you have in NSButton on OS X) what you guys were doing whenever you need some kind of spiced up UIButtons. You're rolling your own, using some kind of UIButton subclass that uses some Quartz drawing or is there any other solutions? I'll probably embarked on designing a UIButton subclass that I can reuse across many apps but just wanted to get a feeling here of what others do, considering again the only choice of a default UIButton and no, I'm not talking about UIBarButtonItem or UITabBarItem that have a nice default appearance, just the poor default appearance of UIButton A custom button style with your own image files as whatever style you want. With the UIButton.contentStretch property you can subdivide your button graphic into distinct areas to stretch or not allowing your button to grow as desired. There are 4 distinct states you can define for each custom button allowing you to have a different image for normal, highlighted, disabled, and selected. In 90% of the cases, the custom button style and properties can satisfy your custom button needs, but if not then you can still subclass. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iOS Popup Menus?
How do you create the popup (and scrollable) contextual style menus that are in Safari's when you click the Bookmark / History button? I can't find a prebuilt class in the UIKit that uses that specific behavior, and find it amazing that there isn't one available. At this point, I am guessing that I can create one with a custom UIView and floating that on top of the main menu that uses a UITableView for the menu items. But there are a number of basic issues that I am not sure how to approach, such as the fact that clicking outside the menu would close the menu. (Do I push a full window sized transparent UIView with the menu as a subview of that and handle clicks that way?) Does anyone have code that already does this? ___ 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
UIGestureRecognizer and CALayers
Are UIGestureRecognizers allowed to be attached to individual CALayers within a UIView layer hierarchy? I originally posted this to the quartz-dev list, but it was recommended to ask here instead. ___ 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
NSCountedSet and NSString values question
I am keeping track of the number of times an object is accessed by key value within a NSDictionary. I am using a manager type class where I request the object from the manager, and it accesses the NSDictionary for the object, therefore I am using a method such as this: - (CGImageRef) imageNamed:(NSString *)name; My question is basically how does NSCountedSet handle string values, are they interpreted by their string values or by their object values? If they are by object, then I need to do more work to pull the exact key object from the NSDictionary. ___ 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: NSCountedSet and NSString values question
On Aug 13, 2010, at 4:14 PM, Greg Guerin wrote: My question is basically how does NSCountedSet handle string values, are they interpreted by their string values or by their object values? If they are by object, then I need to do more work to pull the exact key object from the NSDictionary. NSCountedSet inherits from NSSet and NSMutableSet, both of which use the hash and isEqual: methods of contained objects. See the reference docs for each. In general, docs for a class do not repeat descriptions from a superclass, unless there is a difference. So to fully understand what any class does, you must often read the superclass's docs as well as the docs of the class you wish to use. Thank you for your replies... I guess the issue is really more related to the fact that I didn't understand how NSStrings work with the -isEqual: function. I have been reading up on it, and have read some interesting things including: http://www.drobnik.com/touch/2009/11/the-world-on-an-nsstring/ The author of the article is somewhat unsure whether using -isEqual: is safe, but after looking at the [NSString hash] documentation I feel confident in my current implementation. Short answer... yes. NSSet and subclasses *effectively* compares the value of the NSString and not the object address. ___ 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
CGImage / UIImage non destructive scaling possible
Reading up on the docs for both CGImage and UIImage, I see that there is a scale property, but there doesn't appear to be any way to modify the scale factor of an CGImage without resampling (and therefore changing the pixels). Below is a comment from the UIImage.scale (property) read-only, and if I want to modify the scale of an open CGImage is to save it to disk, and reopen it using the scale factor tag as described below... is this the only way? iPhone 4.0 Library notes from UIImage.scale: If you load an image from a file whose name includes the @2x modifier, the scale is set to 2.0. If the filename does not include the modifier but is in the PNG or JPEG format and has an associated DPI value, a corresponding scale factor is computed and reflected in this property. You can also specify an explicit scale factor when initializing an image from a Core Graphics image. All other images are assumed to have a scale factor of 1.0. ___ 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
Exit( ) necessary? (oalTouch sample project)
I have a question about the oalTouch example project. Specifically the sample code uses the exit( ) function after encountering an error such as in the sample code below. I looked up the OpenAL documentation for alGetError( ) and no where does the OpenAL documentation for alGetError( ) mention that an error returned is considered fatal and the program must exit. So what I am wondering is if this is simply a lazy example from Apple (without any nice UI warning errors), and should not actually affect the performance of the app. Obviously if there is an error loading the sound resource, the sound cannot play. But I am asking this here anyways in the case that there is actually an issue where exit( ) is required. Excerpt from oalTouch sample project - (void) initBuffer { ALenum error = AL_NO_ERROR; ALenum format; ALsizei size; ALsizei freq; NSBundle* bundle = [NSBundle mainBundle]; // get some audio data from a wave file CFURLRef fileURL = (CFURLRef)[[NSURL fileURLWithPath:[bundle pathForResource:@sound ofType:@caf]] retain]; if (fileURL) { data = MyGetOpenALAudioData(fileURL, size, format, freq); CFRelease(fileURL); if((error = alGetError()) != AL_NO_ERROR) { NSLog(@error loading sound: %x\n, error); exit(1); } // use the static buffer data API alBufferDataStaticProc(buffer, format, data, size, freq); if((error = alGetError()) != AL_NO_ERROR) { NSLog(@error attaching audio to buffer: %x\n, error); } } else NSLog(@Could not find file!\n); }___ 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: Exit( ) necessary? (oalTouch sample project)
On May 27, 2010, at 2:40 PM, Luke the Hiesterman wrote: That is most likely there for simplicity of the code example. Since Touch is in the name, I'm assuming this example is for iPhoneOS? If so, please remember that exit() should never be called in an iPhone program. Only the user should exit your program. Yes, it is for the iPhone, and oalTouch is the only sample project that I am aware of to demonstrate OpenAL for iPhone. ___ 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 resource cache - memory question
On May 5, 2010, at 9:25 PM, Shripada Hebbar wrote: I don't see any point in doing this on our own as the iPhone OS anyway gives you memory warning when we are consuming too much of it, and this is the right occasion to cleanup anything that is not needed ( in applicationDidReceiveMemoryWarning: message). Perhaps you are trying to implement some cache such as image or audio specific to your app, in that case, you can in advance set the limit say 5 or 10 MB and if the cache exceeds, delete the least recently used item? Or when you receive memory warning, perhaps delete all items in the cache.. I am trying to implement a generic resource management singleton class that will load all of the images, sounds, and data files for the app. This resource manager will keep track of how frequently each object is requested (or in the case of sounds when they are played). Then when an applicationDidReceiveMemoryWarning: message was received, the manager would purge from memory the less frequently used items (but ready to load them again if they are requested). I am trying to implement David Duncan's suggestion, but because I am dealing with images and sound, its not clear how much memory is actually being used (although worst case estimates can be made). Thats why I was wondering if there was a generic approach to get either the total app memory used, or get total memory used by a particular object (recursively following pointers of course). ___ 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 resource cache - memory question
On May 6, 2010, at 11:02 AM, David Duncan wrote: I am trying to implement David Duncan's suggestion, but because I am dealing with images and sound, its not clear how much memory is actually being used (although worst case estimates can be made). For images I would use a cost estimate of width * height * 4 (this is typically what the memory cost to decompress and display an optimized PNG). Yes, this is what I was planning for image memory estimates. Should I also add in something for a image header especially if I use a lot of tiny images? I was thinking something like +64 to +128 bytes to the estimate. Also I think I will be storing the UIImage object in resource manager but only exposing the CGImageRef as read-only data. I would assume that most of the header properties would be mapped from the CGImageRef to the UIImage. For audio this is more difficult as it is unlikely that the entire file will be loaded into memory, or even that a significant amount of it will be loaded into memory unless it is playing (in which case you do not want to unload it). At this point, I don't even know which sound API am going to use. ___ 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 resource cache - memory question
I am designing a slightly smarter resource cache that purges less frequently used resources instead of a purge all when getting an UIApplication delegate applicationDidReceiveMemoryWarning: message. I know the target (currently) is 20 MBs (although that could change with future hardware). The problem I am running into is finding out if I have purged enough. Is there a method to get the current app memory allocation for the iPhone? Also is there a constant that I can compare it to (memory value to issue warning)? This would allow me to do a loop something like: while (appCurrentMemory issueMemoryWarningAtValue) { [self purgeOldestAccessedObject]; } ___ 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
CFUUID question
Is my assumption correct that the CFUUID class only generates RANDOM UUID values? (i.e. UUID version 4) I am interested in creating a reproducible UUID based on a string input value (such as UUID version 3 or 5), and this doesn't seem possible with CFUUID. ___ 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: CFUUID question
On Apr 28, 2010, at 12:49 PM, Douglas Davidson wrote: Is my assumption correct that the CFUUID class only generates RANDOM UUID values? (i.e. UUID version 4) I am interested in creating a reproducible UUID based on a string input value (such as UUID version 3 or 5), and this doesn't seem possible with CFUUID. CFUUIDCreate() generates a new random UUID. CFUUIDCreateWithBytes() and CFUUIDCreateFromString() create CFUUID objects based on existing values. From my understanding of the documentation, both of these functions are only to create a CFUUID object based on either raw bytes or a string format of an EXISTING UUID. MD5 is more of what I am looking for, but in the UUID format to avoid the MD5 collisions. For example a new UUID based on something like [NSString stringWithFormat:@%...@%@%@, machineUUID, [game description], [player name]]. The resulting UUID could be generated at any time given the source key value, but the source key would not be exposed within the UUID. ___ 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 read-only rule for Memory Management
On Apr 26, 2010, at 10:50 PM, Ken Thomases wrote: No. The get prefix is used for return-via-pointer. For example, -[NSString getCharacters:range]. As documented here http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/CodingGuidelines/Articles/NamingMethods.html. Cheers, Ken I see... thank you everyone! The key phrase here is in the link provided by Ken Thomases (I was looking for this before I asked question): developer.apple.com/.../NamingMethods.html: Use “get” only for methods that return objects and values indirectly. You should use this form for methods only when *multiple* items need to be returned. ___ 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
question about read-only rule for Memory Management
Assume that an array of images is loaded at the start of the app. There are a number of views which will be displaying multiple copies of the image, but they will be accessing the image array as a read-only property, and I do not plan to have these views adjust the reference count for each image. Question: is the BELOW method named appropriately? - (UIImage *) getImageWithTag:(NSString *)tag; ___ 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
Questions about 2D drawing in Cocoa
I am fairly new to Cocoa, and so I have 2 questions I would appreciate some feedback. For a beginner, Cocoa suffers from the too much info problem and its often difficult to find the answers to seemly simple questions. I have had better luck learning from books, and have purchased the following books: Cocoa Recipes for Mac OS X: Second Edition (Vermont Recipes) by Bill Cheeseman Cocoa and Obj-C: Up and Running by Scott Stevenson The iPhone Developer's Cookbook: Second Edition by Erica Sadun While these books are great for general Cocoa needs, I want to dive deeper into 2D drawing with Cocoa. 1. Are there any books that you would recommend that deal specifically with designing custom views and drawing using CoreGraphics? (I prefer CG drawing because more available options and easier to share code between desktop and iPhone apps). 2. Secondly, for several of my desktop apps I am working on I need to use a custom designed Tab interface. This interface is just to control the tabs and the view does NOT contain the mechanism to switch between tabbed views (will use borderless NSTabView for that). I want to have a containing class which holds the tab button cells, while the containing class only manages the position of the tab button cells, and encapsulates messages when each button is pushed. Are there any code examples like this that you know of? ___ 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: using coregraphics with vector art from illustrator
On Apr 19, 2010, at 2:49 PM, Jens Alfke wrote: Is there perhaps a way to create vector art paths in illustrator, and import the data into xcode and use those paths in CG and stroke/fill them there? Save the path as a PDF file, and then load and draw it as an image. Would that make a opaque white box around the shape? What about transparency... would that be retained or would it be flattened? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
What is the best approach for custom tab bar interface?
I need to have a tab style interface, but am not able to use the built in NSTabView because the style is not customizable. Basically I need something similar in look to the Safari tabs, but on a VERTICAL direction. At this point I am thinking about a custom NSView with CALayers for each tab element and then handling the MouseDown and MouseUp events to capture the button press. Or is there another approach I can take? ___ 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 is the best approach for custom tab bar interface?
On Apr 8, 2010, at 8:22 AM, Gideon King wrote: Absolutely. Use an NSTabView, but set it to be tabless, and create your own control to change the selected tab. My question isn't how to get the Tabs to work, but the control which controls the tab switching. =) I need to have a tab style interface, but am not able to use the built in NSTabView because the style is not customizable. Basically I need something similar in look to the Safari tabs, but on a VERTICAL direction. At this point I am thinking about a custom NSView with CALayers for each tab element and then handling the MouseDown and MouseUp events to capture the button press. Or is there another approach I can take? ___ 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: OS X Game Programming
On Apr 7, 2010, at 10:31 AM, Laurent Daudelin wrote: Is there an easy way to download the whole package? I looked around and besides downloading each item individually, I didn't see anything like a dmg or zip or svn link. At the far top-right, there is a button labeled Get Source which lets you download the source in several formats including ZIP. ___ 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: Wondering about that iPad page curling
On Apr 7, 2010, at 4:46 PM, Fritz Anderson wrote: Given that the article's title and opening paragraph suggest that it's about something pretty elementary, and site wants a free registration to show you any more, I'd like to hear from people who have read the whole thing whether page-curling is really in there, and maybe a thumbnail of what the author said. I signed up and read it... and its there. The only issue I had with signing up is that it seems like that is the only useful iPhone tutorial on the entire site. But in fact the tutorial is quite good, especially for someone familiar with Cocoa but hasn't written an iPhone app. No special hacks were used, just declared constants for animation styles. ___ 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 Programming For OS X Coders?
On Apr 6, 2010, at 7:06 PM, Henry McGilton wrote: There's no NSBezierPath parallel on the phone, so you get down into Core Graphics a lot more than with Appkit. iPhone 3.2 SDK just added UIBezierPath, but the 3.2 OS will only run on iPad right now. Who knows if the iPhone will ever run 3.2 OS or if they will just wait until 4.0. ___ 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
Runtime check if C function exists
I am wanting to perform a runtime check to see if a particular C function exists. While in this particular case, the C function I want to use is only available as part of 10.6 SDK (there are examples of this in archives), but I want to know if there is a runtime method similar to @selector that would work on C generic methods. ___ 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: Solving memory leaks
On Mar 28, 2010, at 10:42 AM, mmalc Crawford wrote: That would be gut for the fact that my fields are released and set to nil whenever a new SELECT query is executed - however, I think I can do this by emptying the array when a new query is done and just counting the size of the array in my fetch method - thanks... Why not follow what someone else suggested earlier in the thread, and the pattern that is recommended in the documentation, and use accessor methods. As soon as you start sprinkling retains and releases throughout your code, you're liable to make a mistake. http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html#//apple_ref/doc/uid/TP40004447 Plus when you use accessor, you can put in a call to your NSLog( ) and see exactly whats going on... - (void)setFields:(NSMutableArray *)newFields { NSLog( @-setFields, old fields value: %p with new value %p, fields, newFields ); [fields autorelease]; fields = [newFields mutableCopy]; } When calling setFields, you are then responsible for releasing the newFields NSMutableArray you created in your sample code, because [newFields mutableCopy] increments the ref counter. ___ 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: Compiler Warning: 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:'
On Mar 26, 2010, at 1:23 AM, Alec Stewart wrote: This compiler warning 'NSDate' may not respond to '+dateWithTimeInterval:sinceDate:' is driving me up the wall. I don't understand why I am getting the warning because, by all indications, +dateWithTimeInterval:sinceDate: has not been deprecated. I would be extremely grateful for any insight. Here's my code: NSDate *dateWithoutHundredths; dateWithoutHundredths = [NSDate dateWithString:[NSString stringWithFormat:@%04d-%02d-%02d %02d:%02d:%02d +, year, month, day, hour, minutes, seconds]]; NSTimeInterval hundredthsToAdd = (double)(hundredth / 100.0); date = [NSDate dateWithTimeInterval:hundredthsToAdd sinceDate:dateWithoutHundredths]; //This is the line the warning shows up on Tech notes say: + (id)dateWithTimeInterval:(NSTimeInterval)secondssinceDate:(NSDate *)date Is only available in OS X 10.6 and higher. If your compiler Base SDK is set for 10.5, then that is probably the issue. As an alternative, you can use a 10.0 compatible function: - (id)initWithTimeInterval:(NSTimeInterval)seconds sinceDate:(NSDate *)refDate___ 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