cocoa-touch

Deallocating and removing UiButtons

那年仲夏 提交于 2020-01-15 19:14:34
问题 I am trying to make a program that dynamically creates a button using the command: [UIButton buttonWithType:UIButtonTypeRoundedRect] But when I use these commands the delete the button I create: [currentButton removeFromSuperview]; [currentButton dealloc]; [currentButton release]; I receive an error. How would I go about removing and deallocating the memory from a uibutton? 回答1: In the Objective-C/Cocoa framework, you encounter two different ways to receive objects: ones which you have

Deallocating and removing UiButtons

China☆狼群 提交于 2020-01-15 19:11:11
问题 I am trying to make a program that dynamically creates a button using the command: [UIButton buttonWithType:UIButtonTypeRoundedRect] But when I use these commands the delete the button I create: [currentButton removeFromSuperview]; [currentButton dealloc]; [currentButton release]; I receive an error. How would I go about removing and deallocating the memory from a uibutton? 回答1: In the Objective-C/Cocoa framework, you encounter two different ways to receive objects: ones which you have

UITableView doesn't populate when waiting for CLLocationManagerDelegate 's didUpdateToLocation method on iPhone SDK

房东的猫 提交于 2020-01-15 14:09:25
问题 I'm trying to populate a UITableview with an array of cells. I usually do this from the viewDidLoad method but this time I want to populate the array based on location. Below is the first line of my interface: @interface RootViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource, CLLocationManagerDelegate> { In the implementation file the viewDidLoad method looks like this: - (void)viewDidLoad { // for location self.locationManager = [[CLLocationManager alloc] init

iOS popovers as menu tutorial

£可爱£侵袭症+ 提交于 2020-01-15 11:44:46
问题 I am writing an iPad app and am very new to objective C. I am currently trying to use a popover as a menu within a view controller. I understand how to set the popup up and have a tableview in it for a user to select an item from. However, I am not sure how to then pass the information back to the container view which holds the popover. didSelectRowAtIndexPath will be called within the UITableViewController which is presumably inside the popover view controller. Can anyone point me in the

Broken cell with an odd strikethrough?

╄→尐↘猪︶ㄣ 提交于 2020-01-15 11:25:09
问题 I'm having a weird issue with a particular UITableView in my iPhone devel experience here. If you look at the following screenshot: alt text http://dl-client.getdropbox.com/u/57676/brokencell.png you'll notice a strike through going through the middle of the 'Jane Aba' cell. Any idea what might be causing this odd graphic display? It's true for both the simulator and for the actual device running 2.2 SDK. As requested, here's my -tableView:cellForRowIndexPath: method: * EDIT * I've located

iOS App crashes when using colorWithRed:green:blue:alpha

雨燕双飞 提交于 2020-01-15 11:18:08
问题 I have a UIControl subclass in my iOS App (I'm using iOS 4.3), and part of the subclass is a method called "setButtonColor:(UIColor)bc". Whenever I call this method from my code, it works fine...but only if I use a built-in color like greenColor or redColor. If I use " colorWithRed:green:blue:alpha ," to make my own color it crashes with this message in the console: -[UIDeviceRGBColor set]: message sent to deallocated instance 0x4e61560 Here's the setButtonColor: method: -(void)setButtonColor

Cocoa Touch UIViewController Properties and class design

人盡茶涼 提交于 2020-01-15 10:27:28
问题 I'm creating a custom ViewController. This VC needs to load some data that is known in the event that creates it and pushes it to the top of the NavigationController that it is going to be part of. My question is, how should I pass data from the view that handles the custom ViewController's creation into that custom ViewController. I've thought of four possible options, and I was hoping to get feedback on why each one is good or not for this functionality. 1) Expose public properties in the

Setting border around custom UIBarButtonItem

ⅰ亾dé卋堺 提交于 2020-01-15 09:16:07
问题 I want to put a custom button as right navigation bar button item. Here is the code: UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:[UIImage imageNamed:@"my.png"] forState:UIControlStateNormal]; [button addTarget:self action:@selector(filterResult) forControlEvents:UIControlEventTouchUpInside]; [button setFrame:CGRectMake(0, 0, 50, 50)]; self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithCustomView:button] autorelease]; The problem is

Signature invalid only for ad hoc

爱⌒轻易说出口 提交于 2020-01-15 07:53:32
问题 I'm not sure what changed on my ad hocs but I get this error when trying to install: Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate. (-19011) Device debug builds fine. The cert that is associated with my ad hoc provisioning profile doesn't expire until 2011. I've searched Google but haven't found any applicable solution, except some mention about deleting and recreating the certs. Before I go down that rode, has

GCD vs custom queue

不羁岁月 提交于 2020-01-15 05:54:26
问题 I was wondering what is the difference in performance between these two. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ // perform complex operation // dispatch back to main thread to update UI }); dispatch_async(_myCustomConcurrentQueue, ^{ // perform complex operation // dispatch back to main thread to update UI }); My assumption is the GCD is used across the os and other applications, and it will need to perform very quick background tasks, and be finished