cocoa-touch

NSArray element comparison to NSString

Hi, I am trying to find a word inside a phrase (NSString). For this I've exploded the components of the phrase into individual substrings and now I am trying to compare them to the word I am looking for, but it doesn't work. What would be the correct approach for this and fix for the software below? NSString *myString = @"Mi Programa...

How to code smooth scrolling for "flick" gesture on iPhone

I have horizontal list for which I'm implementing my own scrolling logic. I have the "touch and drag" scrolling working great, but I'm having trouble with the "flick" gesture. All the built in scrollable views have the feature that if you "flick" the view it scrolls faster or slower based on the intensity of the flick. Does anyone has a...

Values of passed in variables don't retain

I'd like to split up executing a query. The myprepare function below opens the database connection and runs the sqlite3_prepare_v2 function. Once sqlite3_open is executed within the scope of the myprepare, selectstmt and database have valid addresses assigned to them. However, once I come out of myprepare, their addresses are wiped t...

UITableView Problems with cellForRowAtIndexPath

I am trying to fill a uitableview with multiple sections. This is my code: static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] au...

NSOperation and the Autorelease pool

I created an NSOperation. Do I also need to create an autorelease pool for this or is it all handled for me like voodoo black magic? ...

What is NSString in struct?

I've defined a struct and want to assign one of its values to a NSMutableDictionary. When I try, I get a EXC_BAD_ACCESS. Here is the code: //in .h file typedef struct { NSString *valueOne; NSString *valueTwo; } myStruct; myStruct aStruct; //in .m file - (void)viewDidLoad { [super viewDidLoad]; aStruct.valueOne = @"firstValue"; } /...

iPhone UIWebView PDF Page Jump

I want to view a local PDF (in my iPhone app) and be able to jump to a specific page. Seems like the UIWebView is the way to go, however, I can't find any information on jumping to specific pages. Is this impossible? Are there any other techniques I can use? thanks, Howie ...

How do I get the pixeldata of an imageView?

Hi, all! I want to get pixeldata of an imageView (i.e. all the pixels occupied by the imageView in an NSMutableArray) which I need in order to detect collisions between two imageViews. Can anybody please help me? ...

UIImagePickerController overlay autorotate

I am using the UIImagePicker to access the camera on my iPhone app. I would like to be able to have two different overlays for the imagepicker, depending on the orientation of the iPhone. Is it possible to do this? It seems like if I place the following method in the class that owns the UIImagePickerController, it does not get called at ...

Is NSPersistentStoreCoordinator Thread Safe?

I'm working on an iPhone app that uses Core Data. The app makes a call to a web service, parses the resulting XML file, and then creates or modifies Core Data objects in my app. I already handle the web service call and parsing asynchronously, but I've been handing the parsed data back to the main thread to manipulate the Core Data objec...

Where to use UIActivityIndicatorView ?

I have written my code in -(void)loadView{ } to get an image from internet using NSURL. But before loading image I need to show the spinner( UIActivityIndicatorView ). #import "ImageFromWebViewController.h" #define USE_TEST_SERVER 1 @implementation ImageFromWebViewController +(NSString *)fileName { #if USE_TEST_SERVER return @"ht...

UIScrollView not scrolling

I'm loading a UIScrollView with UIImageViews. imageViews below is an NSMutableDictionary of UIImageViews. The scrollview is an IBOutlet with scrolling and paging enabled. The loop adds two images. However, I only ever see the first image in the scrollview and am not able to scroll. Is there something else I need to enable for scroll...

How to move UITextView correction suggestion above text

I'm using a UITextView to roughly replicate the SMS text box above the keyboard. I'm using a UITextView instead of a field so that it can expand with multiple lines. The problem is that, in my UITextView, the correction suggestions pop up below the text, causing them to be partially obscured by the keyboard. In the SMS app, the sugges...

Correctly deallocating a view

In a view based app, I display a view and once the user is finished with that view, Done is clicked and the view is removed. However, that does not dealloc the view, which is what I want to do. What is the proper way to dealloc this type of view? Currently, I'm nil'ing out the second view before it is called. That seems to work and t...

How many UITableView can place in a View?

I'm beginner in Iphone! Can I place many UITableView (greater 1) in a View? And how to control them? ...

NSOperation and NSOperationQueue callback

I have a class. Inside this class I pass an NSOperation into the NSOperationQueue that lives in my global variables. Now my NSOperation is finished. I just want to know that it is finished in my class and to have the operation pass data to that class. How is this typically done? ...

UIControl - changing assigned selectors: addTarget & removeTarget

I'm using 10 buttons in my interface and need, from time to time, to change the button's selector. Am I required to use: -(void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents before I change the selector or can I just use: -(void)addTarget:(id)target action:(SEL)action forControlEvents:(...

How to start playing a music playlist on the iphone?

Right now now I'm thinking about getting a playlist through MPMediaQuery and then add the items inside my MPMediaPlaylist to the MPMusicPlayerController using setQueueWithItemCollection. Is there a way to pass the MPMediaPlaylist directly to the player? ...

Change iPhone volume without user interaction, is it possible?

I've seen this thread but this is only useful if I wanted the user to pick the volume himself. I wanted my application to change the volume gradually. Thanks. ...

TouchXML - CXMLDocument object failed to initialize

Hi all, I am stuck with some TouchXML code. Please help. I have the following code to get the data from an xml webservice: NSData *urlData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error]; NSString *data = [[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding]; NSLog(@"Strin...