cocoa-touch

Referring to an NSString in output of UIAlertView?

懵懂的女人 提交于 2019-12-25 04:09:04
问题 I have an NSString , testString which is set to a value in my app. Then as a response to a button press in UIAlertView I have the following code: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex { if (buttonIndex == 0) { NSLog(@"String: %@", testString); } } But for sme reason, this always causes the app to crash. I can't seem to figure out why. 回答1: Probably you create your string with one of convenience methods and don't retain it, so when it comes to

Cut out a part of a long NSString

﹥>﹥吖頭↗ 提交于 2019-12-25 04:04:18
问题 In my app I want to show a String that contains news. This string is being loaded just from a free Website, so the plain source code of the website does not contain only my string, its is more os less like this: Stuff More Stuff More HTML Stuff My String More HTML Stuff Final Stuff And of course i want to cut off all the html stuff that i don't want in my NSString. Since i am going to change the String fron time to time the overall length of the Source code from the website changes. This

Cut out a part of a long NSString

余生长醉 提交于 2019-12-25 04:03:10
问题 In my app I want to show a String that contains news. This string is being loaded just from a free Website, so the plain source code of the website does not contain only my string, its is more os less like this: Stuff More Stuff More HTML Stuff My String More HTML Stuff Final Stuff And of course i want to cut off all the html stuff that i don't want in my NSString. Since i am going to change the String fron time to time the overall length of the Source code from the website changes. This

Call action from UIWebView with JavaScript

北城余情 提交于 2019-12-25 03:58:06
问题 I am trying to build a simple app that uploads images to my site. I am using this tutorial: http://www.youtube.com/watch?v=aQXaJO36I7Y What I want to do instead of using a button from the app's interface I wan to use a button within a website in a webview. So I want a button to call the opening of the photo album to select a image to upload. Basically I need a way for a javascript function to call a action in the app itself. How can I do this? 回答1: You could just use a custom link, which you

Memory Leak while using UIWebView Load request in IOS4.0

不羁岁月 提交于 2019-12-25 03:52:03
问题 I have a Web View Which loaded as a modal view. I am having memory leaks after loading a webpage using the following code. [myView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:30]]; My dealloc method is below: - (void)dealloc { myView.delegate = nil; [myView release]; [url release]; [super dealloc]; } Instruments showing 5 blocks of GeneralBlock 32 leaks, but no stack trace available. The leak Happens

What's the most *simple* way to implement a plain data object which conforms key-value-observing?

痴心易碎 提交于 2019-12-25 03:46:10
问题 What's the most simple way to implement a plain data object which conforms key-value-observing? 回答1: Make an class with properties for its plain value attributes and KVC-compliant collection accessors for collections. Foundation magic will take care of the notifications for a simple object like that. 来源: https://stackoverflow.com/questions/5386497/whats-the-most-simple-way-to-implement-a-plain-data-object-which-conforms-key

What can we do with facebook api in iphone application?

♀尐吖头ヾ 提交于 2019-12-25 03:46:05
问题 I want to use facebook api in my iphone application. I know that we can post to walls with facebook api but i have no idea about other features like :- edit profile send messages add friends get friends information etc. So can anybody give me details about all the things we can or cannot do with facebook api ? 回答1: Here is a non-Facebook.com explanation of what the API can do: http://en.wikipedia.org/wiki/Facebook_Platform 回答2: Check out the Facebook-ios-sdk. The top level readme gives a good

How do you animate the resizing of a tableView without its rows/subviews getting clipped?

跟風遠走 提交于 2019-12-25 03:39:13
问题 EDIT: I originally asked this question in regards to general view resizing, but I realize now that it's something much more specific to tableViews. Say that a tableView originally has a frame of (0 0, 320 460), i.e., it fills an entire iPhone screen. In order to resize the tableView's height and animate the resize, I map the following code to a button: [UIView beginAnimations:@"Animation" context:nil]; [UIView setAnimationDuration:3]; CGRect rect = self.table.bounds; rect.size = CGSizeMake

Does NSFetchRequest setPropertiesToGroupBy: return all entities that match?

China☆狼群 提交于 2019-12-25 03:32:56
问题 I'm developing an app for iOS, and I can't find much documentation on the new NSFetchRequest setPropertiesToGroupBy: method. I have a bunch of entity A objects that have relationships with multiple entity B objects. I want to fetch all entity B objects that match a specific pattern and group them by entity A. This is so that I don't have a separate DB fetch for every entity A. The results would ideally be structured so that I could iterate over groups of equal entity As, and then would have

Can't find the leak in this Objective-C NSXMLParser code?

寵の児 提交于 2019-12-25 03:27:21
问题 I am new to iPhone programming, and am running my app against the Leaks tool in Instruments. The tool is finding a few leaks, all of which seem to point to 1 line of code in a class which uses NSXMLParser: - (BOOL)parse{ NSURL *url = [[NSURL alloc] initWithString:@"[url here]"]; NSXMLParser *parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:self]; NSLog(@"NSXMLParser initialized"); [parser parse]; [url release]; [parser release]; return YES; } The tool points to