iphone

How to correctly removeFromSuperview?

Apple says: removeFromSuperview Unlinks the receiver from its superview and its window, and removes it from the responder chain. (void)removeFromSuperview Never invoke this method while displaying. So, when I want to get rid of a view, I was used to just kick it off from it's superview. Why should I never in...

In Objective-C, how do I test the object type?

I need to test whether the object is of type NSString or UIImageView. How can I accomplish this? Is there some type of "isoftype" method? ...

Memory leak in removeItemAtPath:error:?

I'm running an app on the iPhone that performs the following action: + (void)performWrite:(NSData *)data { [data retain]; [data writeToFile:@"WriteTest.tst" atomically:YES]; [[NSFileManager defaultManager] removeItemAtPath:@"WriteTest.tst" error:NULL]; [data release]; } When running in Instruments, however, I see a lea...

How can I change the saturation of an UIImage?

I have an UIImage and want to shift it's saturation about +10%. Are there standard methods or functions that can be used for this? ...

__OBJC__ equivalent for Objective-C++

I'm compiling a .mm file (Objective-C++) for an iPhone application, and the precompiled header fails to include the base classes. I tracked it down to the following: #ifdef __OBJC__ #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #endif Turns out, __OBJC__ is undefined for mm files, whereas it is defined for standar...

Core Data Fetching Objects That Are in Relationship to another object

I want to fetch objects B which has a to-many relationship with object A (ie. A -->> B). I already have A in memory. I know I could get a NSSet of the B objects from A, but would it be better to make a fetch request of the B objects (especially if I want to sort sections by date in a UITableView)? How would I make such a request that on...

How to define the order of overlapping MKAnnotationViews?

I have several MKAnnotations (and their corresponding views) in my map, and it sometimes gets really crowded. Now, the annotations in my app come in two flavors: some are bound to stay where they are, while others will move as time goes on. I'd prefer to have the more stable ones visually in the background and the moving ones to always p...

iPhone and Core Data

Hi, I need some understanding about using Core Data. Can it be used to save and retrieve all of my objects used in my program? Is there any simple example demonstrating this ? I am having hard time finding one online. Thanks for any replies. ...

Nib objects (subviews) accessing properties in ViewController

Edited for brevity: How does a subview access properties in its superview and its superview's view controller? Easy enough to go down the chain. How do we go back up? Original (verbose) post: The immediate problem I'm trying to solve is simplifying the "birth" of a somewhat complex view. The large picture has to do with Nibs and how...

Patterns for accessing remote data with Core Data?

I am trying to write a Core Data application for the iPhone that uses an external data source. I'm not really using Core Data to persist my objects but rather for the object life-cycle management. I have a pretty good idea on how to use Core Data for local data, but have run into a few issues with remote data. I'll just use Flickr's API ...

How to flip coordinates when drawing in context?

I create a context from an UIImage, and then I draw into it with CGContextDrawImage(bitmapContext, CGRectMake(0, 0, originalImage.size.width, originalImage.size.height), oImageRef); the image appears upside-down due to the flipped coordinate system in quartz. How can I fix that? ...

write and read Plist

Hi, I have the next question, if possible to write in a .plist datas in runtime, because my app make a lot of connections and i would like to save this datas (after parsing) in a plist, for later read this datas. Is it possible? because i'm trying and for the moment i can't. Thanks. ...

how to read a http video stream with libavcodec (ffmpeg)

hi all, I'm trying to read a real-time http video stream (I've set one up using VLC and my webcam) using libavcodec from ffmpeg. so far I've been able to read an mpeg file fine but when I pass a url instead of the file name it hangs (I assume it's waiting for the end of the file). anyone have experience/ideas on how to do this? I'm a...

Can autocapitalize be turned off with javascript in mobile safari?

Mobile safari supports an attribute on input elements called autocapitalize [documented here], which when set to 'off' will stop the iPhone capitalizing the text input into that field, which is useful for url or email fields. <input type="text" class="email" autocapitalize="off" /> But this attribute is not valid in html 5 (or another...

iPhone app pricing model question?

I have heard there has been some studies of the apple app store for the iphone. It was a comparison between having a free application supported by ad vs a .99 cent application. .99 cents seems to be the sweet spot for a lot of the smaller applications. Anyone know where those studies were done? Are people having better success with .99 ...

Is it possible to prevent the iPhone from adding the 'shine' to my app's icon?

When you define an icon for your app in XCode and then run it in the simulator or on a real device, the icon is automatically trimmed so it has rounded edges and a 'glossy' sheen is applied over top of the icon. I'd like to get rid of that sheen since it's obscuring some of the detail in my icon. It seems like some other apps are able ...

iPhone Developer company registration

I applied to Apple iPhone developer program to register my company. Five days later I got an email asking me to fax 3 documents. The first two I know what they are but they are also asking for a "Corporations Charger". Given that this only return 16 useless results in google, it looks like a pretty uncommon weird thing! Anyone got throug...

Safe way to change the priority of an NSOperation

Is there a safe way to change the priority of an NSOperation that is already enqueued in an NSOperationQueue? If the operation hasn't started yet there is no problem, but if it is already executing I get an NSInvalidArgumentException. ...

Software development methodology when doing Iphone development

What kind of practices do you do when developing iPhone apps? For instance, do you write up a technical design document of any sort. Do you write down the design of your app at all? Do you implement a certain methodology agile/scrum/waterfall etc...? I'm just curious when working on projects like an iPhone app, what kind of best practice...

UITableViewCell changes from 2.1 to 3.0 - Duplicate Cells

I have a subclass of UITableViewCell that I create for a UITableView. Let's say I have 26 cells (letters of the alphabet). In SDK 2.1 I load the first six cells, A->F, then scroll down and it loads the next six cells (G->L). In SDK 3.0 I load the first six cells, A->F, then scroll, it reloads the first six cells again (A->F), instead o...