objective-c

UIAlertView Display while iPhone is asleep and locked

I am writing an app the is pretty much always going to be open (hardly ever would run in background) and I want to be able to alert the user with a sound, vibrating the phone, and showing an alert message when there is a state change. The problem I am having is that when I use the UIAlertView, the AlertView seems to be hit or miss wheth...

Best way to combine existing views/controllers?

Hello, I have an existing iPhone View Controller with a corresponding view (via nib) that displays an interactive graph. The user can touch a cursor point to move along the curve and get data corresponding to the touch point. Now, I'd like to create a new screen that is a kind of "compare" screen the combines two of these existing vie...

iPhone: NSXMLParser not seeing all the tags?

I'm trying to parse an XML feed from youtube. The XML feed graphically looks like this: To check if each of the 'tags' are being hit correctly, I used the following standard methods: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName ...

CGRect image sizing question

I'm using CGRect to display an image. I'd like the CGRect to use the width and height of the image without me specifying it. can this: CGRectMake(0.0f, 40.0f, 480.0f, 280.0f); become this: CGRectMake(0.0f, 40.0f, myImage.width, myImage.height); some images get distorted when I specify the parameters. here's the code: CGRect myIm...

Objective C --- Array is readable in a (void) function but not an (IBAction)

Hey all, I have an array that holds all of the .aif file paths in my app, which I found by using mainBundle and resources. This array needs to be passed down through 2 view controllers to reach where it is actually used. The problem is, it either crashes or logs something totally wrong. When I debug I get an EXC_BAD_ACCESS note at the c...

imap custom keywords

where do I begin? I can't seem to find any definitive documentation. (I am probably looking in the wrong places....). I want to be able to edit IMAP keywords (for tagging purposes) for email messages. I have some really noobie questions; how are they added? are keywords applied directly to message headers (if so, what is the syntax), ...

Why is my application terminating in the middle of unit tests?

The Problem I run my unit tests. At one point, I wait using: [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:1]]; for an NSOperationQueue to be empty. When my app reaches this line, it terminates immediately. It's run this exact same line with other tests. All tests were working perfectly recently. It al...

Pinching works great in Simulator, but doesn't work at all on device

Has anybody come across this problem? I have created an UIScrollView of images, much like the Camera Roll. Each image can be pinched to zoom in and out. Got my code working great on the simulator. I put the code on my device (both an iPhone and an iPod Touch) and nothing. The images don't pinch, nothing happens. Am I missing someth...

"Operation couldn't be completed. Connection reset by peer." with NSURLConnection on iOS

Hello. I'm struggling sending POST data to a server and receiving the correct response. I started by using setHTTPBody but moved to setHTTPBodyStream when I wasn't getting the correct server response for certain POST data and I read setHTTPBody has a memory leak on earlier iOS versions. The problem is setHTTPBodyStream causes the error -...

Switching to another View with UITabBar

Hello, I just started developing with the iPhone SDK and I have a problem with switching to another tab with the UITabBar. This is my current code, and it works so far: myAppAppDelegate *appDel = (myAppAppDelegate *)[[UIApplication sharedApplication] delegate] [appDel.tabBar setSelectedViewController:[appDel.tabBar.viewControllers obj...

Does Apple provide any API to retrieve the weather information?

Hi, everyone, I want to ask a question about the iPhone application. Does Apple provide any API for developers to get the weather information? Thank you. ...

NSString character position

NSString *url = @"http://stackoverflow.com/questions/ask"; How can I get the character position of the 4th "/" ? ...

Objective C - Making UIAlertView wait for user input?

I have a UIAlertView set up with a textfield like so: //***first set of code*** UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"User Input Required" message:@"Please enter data into the field" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil]; [alert addTextFieldWithValue:nil label:@"[Enter Text]"...

unicode to zh-cN

NSArray *array=[contentOfResponseDataInJsonValue JSONValue]; NSLog(@"%@",array); prints: ( ( ( "\U515c\U639b\U8e55", AABENRAA, " o b\U8c46n lu\U8eab" ) ), ( ), en ) but if (array==nil) { return returnStr=@""; }else { returnStr=[[[array objectAtIndex:0] objectAtInd...

MPMoviePlayerViewController problem

How can I play a movie in my app? I tried using this code, but xcode gives me this error: NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath = [bundle pathForResource:@"welcome" ofType:@"mp4"]; NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain]; movieView = [[MPMoviePlayerViewController alloc] initWithContentURL: m...

Resign First Responder on ScrollView Touch

How can I hide the keyboard on ScrollView touch event... Scenario is like that... ->View ->ScrollView -->Textfield I want to hide the keyboard on touch of scrollView. I tried to override the class for scrollview,but still i can't do it. Please help me with Code.... ...

What is a CALayer?

What is a CALayer (as seen in the layer property on a UIView) and where would we use such a class? ...

form submit through javascript in iPhone sdk application

Hi, I need to post a form loaded in UIWebview (iPhone sdk/Objective c) through javascript injection. I used document.form.submit() which is not working. Plz Plz help.... ...

What is the best location to find tutorials on physics in game development?

I'm very new to game development (iPhone/iPad specifically, if that matters at all) and am having a tough time with working with the physics part of animation. Specifically I'm trying to give several balls (circular UIImageView or CG circles) physical properties (gravity, weight, friction, etc). Are there any really good tutorials on ge...

How to handle user click the "delete button " in setEditing in TableView?

I added a editButton on the table like this: self.navigationItem.leftBarButtonItem = self.editButtonItem; and, having a setEditing method: - (void) setEditing:(BOOL)editing animated:(BOOL)animated { [super setEditing:editing animated:animated]; [self.watchListDetailTableView setEditing:editing animated:animated]; if (...