cocoa-touch

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

余生长醉 提交于 2019-12-25 03:27:09
问题 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

How to detect a touch in a subview that was dragged there (or fastest way to get which subview is underneath a tap in its superview)

跟風遠走 提交于 2019-12-25 03:27:09
问题 I've got a Super View, and its got a bunch of subviews. I'd like a user to be able to drag their finger inside the super view and when they drag over the subviews, that subview changes. I need this to be very efficient, because changes can happen really fast. So far what i've tried, is in the super view I can get the touch events from touchesBegan:withEvent: and touchesMoved:withEvent: These two combined give me all the touches I need. On each call of these methods, I have to iterate through

How to detect a touch in a subview that was dragged there (or fastest way to get which subview is underneath a tap in its superview)

自古美人都是妖i 提交于 2019-12-25 03:27:08
问题 I've got a Super View, and its got a bunch of subviews. I'd like a user to be able to drag their finger inside the super view and when they drag over the subviews, that subview changes. I need this to be very efficient, because changes can happen really fast. So far what i've tried, is in the super view I can get the touch events from touchesBegan:withEvent: and touchesMoved:withEvent: These two combined give me all the touches I need. On each call of these methods, I have to iterate through

Accessing Page From App?

人盡茶涼 提交于 2019-12-25 03:26:49
问题 I am only just starting out with iPhone application development and have been doing some research with regards at getting data into an app using information available via the web. I understand that I can access web pages using the NSURL* classes. Does anyone know how I might request data from a page that requires user input? I can understand accessing an actual page, but I am not sure if (or how) I might be able to initiate the request and get the appropriate data back into my app. Any help /

How can I pass information from one view controller to another? [duplicate]

拜拜、爱过 提交于 2019-12-25 03:26:35
问题 This question already has answers here : Passing Data between View Controllers (43 answers) Closed 5 years ago . This is a Q&A Style Post If I want to pass parameters, such as an NSString , NSArray , or NSDictionary , from one view controller to another, what is the easiest way to do this? 回答1: There are multiple ways to achieve this, but two of the cleanest methods would involve passing the parameter(s) into a custom init method for the next view controller, or setting the parameter(s) as a

is that UIWebView player a MPMoviePlayerController instance, and how to get a reference to that instance?

断了今生、忘了曾经 提交于 2019-12-25 03:22:25
问题 I need to play a youtube video in UIWebview and handle the event when user click the DOne button and when the video finish playing. I think of the solution that will handle the event that sent from UIWebview's media player. My question is: 1. is that the UIWebview's media player a MPMoviewPlayerController? 2. How do i refer to that instance and handle the event it sent out (such as: pause, stop, done, finish playing...) Thanks. 回答1: 1. is that the UIWebview's media player a

How to compare 2 NSArrays like NSPredicate Contains

江枫思渺然 提交于 2019-12-25 03:16:03
问题 Hello guys here is my problem NSArray *recipeIngredientsArray = [recipeIngString componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]; NSArray *haveIngArray = [searchText componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@","]]; if (haveIngArray.count==recipeIngredientsArray.count) { //check the contents of 2 arrays } I have 2 arrays that I take from CoreData and if their array length are the same, I will check

Warning while adding and using a new method in external library protocol

為{幸葍}努か 提交于 2019-12-25 03:12:45
问题 I am using a external library and one of my view controller is registering as delegate for a class in that framework. Now, at one place I want to execute some code on this delegate class. I am writing a method for that and calling it on my delegate. Now, all works fine but I am getting a warning that this newly added method is not part of the protocol. This is my Class: @protocol MyExtendedDelegate <LibraryDelegate> @optional - (void)actionTaken; @end @interface MyController :

UIScrollView contains more views than exist when looping programmatically

主宰稳场 提交于 2019-12-25 03:12:05
问题 I'm resizing my scroll view's content size programmatically. To do this, I look through all of the views contained within it and get the highest value for the view origin plus the view height, then set my content size to that plus 10. For some reason, I have a lot of white space at the bottom of my page. I used an NSLog() to find out what object it thought was this big and found that it is an object that does not even exist. Here is my code: - (void)resize_scrollview_to_fit { CGFloat

How to create a UITableCell that has multiple subtitles

不问归期 提交于 2019-12-25 03:08:46
问题 I came across this design image online and I am really puzzled on how could I make a UITableCell that has multiple subtitles and allows me to customised them in the way shown by the picture. My understanding is that one can only use 1 subtitle per cell. Is there a way to create a UITable cell that looks like that? How would you go on to make those 4 subtitles under the cell title??? 回答1: You could do that easily by having a custom layout for the UITableViewCell. This video should help you in