Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Good night!
Should I use the method - (void) dealloc in file ViewController.m for outlets (where #synthesize is announced at the beginning of the file) that do not have properties retained?
In ARC, you do not need to implement dealloc other than to release resources managed outside of ARC (retained properties are managed by ARC). If you have a property that managed outside of ARC (say a malloced object), you need to free it in the dealloc method (preferably by setting it to nil and handling the freeing in the setter).
If you do implement dealloc, do not call super as you do when not using ARC.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have problem about accessing class, and i ve been looking for solution, couldnt figured out yet.
I have 3 classes:
1 - ViewController
2 - XmlParser
3 - AllDeals,
When i open app, ViewController uses XmlParses class, and XmlParser class parses xml file and stores information into NSMutableArray in the XmlParser Class.
I would like to access that NSMutableArray(in XmlParser class) and all information that it stored already from AllDeals class. I cannot split up Xml file again. it s taking too much time.
When i tried to access nothing comes. I have tried many things.
How am i gonna point or access that class or NSMutableArray...
Thank you for your helps.
Have you tried to use shared instance of XmlParser Class ? If Not then make shared instance whenever you want to use this class and access that NSMutableArray with the help of XmlParser Class shared instance.
if you're aware about the delegates then you can pass values over delegate at the success of your parsing else create one NSMutableArray into your 1-ViewController globally and take advantage of it by passing the parent of viewController to XmlParser then you'll have filled NSMutableArray of your desired output and access it further more.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have a SPObject class, which is a custom NSObject. In the viewDidLoad method of the ViewController, I am creating an instance of SPObject. There is also a button which, on clicked, creates a new SPObject.
When my app goes to the background, I want to save these SPObjects in the database. So, in the applicationDidEnterBackground method, I am getting the instance of the main ViewController using
ViewController * vc = (ViewController *)self.viewController;
I want to know how I can get a list of the current SPObjects in the next line of the above line.
If what I wanted was a list of UIViews, I could have just done,
for(UIView * subView in vc.view.subviews)
which would have returned a good list.
How can I do this?
Have an array property of your objects:
#property (nonatomic, retain) NSMutableArray *objects;
When you create new object add it to this array:
[self.objects addObject:newSPobject];
When entering background get this array:
NSMutableArray *objects = vc.objects;
Now you can do with this array whatever you like
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
WARNING: Using legacy cell layout due to delegate implementation of tableView:accessoryTypeForRowWithIndexPath: in <Settings: 0x250c60>. Please remove your implementation of this method and set the cell properties accessoryType and/or editingAccessoryType to move to the new cell layout behavior.
Here,
accessoryTypeForRowWithIndexPath is deprecated in iPhone OS 3.0.
Instead set like this.
cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
Existed Answers - here
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 9 years ago.
Improve this question
I am trying to use a delegate method in my simple iPhone application but I got an error.
If there are any examples code; pls send me a link or code.
When using delegates there are a few things to take care of.
For example, say you have a class MyController and you want it to be a UITextField's delegate. Put the delegate protocol name in the class's interface:
#interface MyController : NSObject <UITextFieldDelegate>
Then, implement the delegate methods in the UITextFieldDelegate docs (the docs say "All of the methods of this protocol are optional." so you can choose which you want):
#implementation MyController
...
- (BOOL)textFieldShouldReturn:(UITextField *)textField
// do something
}
...
#end
Then finally, set yourself as the delegate:
myTextField.delegate = self;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Since there is no pre-existing component for creating a combobox (or select box) as seen on webpages through Safari, can someone provide an example or pre-existing 3rd party component of creating one?
I don't think this is hard to do.
In a view controller you have a UITextField and a UITableView. Assign the view controller to be the delegate of the both controls, plus the data source of the table.
Implement the UITextField delegate method textField:shouldChangeCharactersInRange:replacementString: in your controller. This intercepts the changes as they are being typed in your text field. In this method, iterate through your list of possible options and store the matches in an NSMutableArray instance variable on your view controller. Then call [myTableView reloadData].
Have your table cells generated from the array of matches you previously stored.
It should be pretty straightforward and shouldn't take much code at all beyond a few delegate methods to get working.