I have a singleton object which has ivar NSMutableArray which holds images global to application. And I have a UITableViewController class which represents image attaches to the message.I want to do next: when user select images from Camera Roll they are added to that singleton's array. And I want to reload tableview of my UITableViewController at once to display these new messages. How can I implement this? Should I use Key-Value Observing for this and if yes how can I do this? (I should notify when new object will be added to array). Or may be there are some other more correct way?
-
When you add object to array call [tableview reloadData]Jim Rhodes– Jim Rhodes2013-07-18 13:43:37 +00:00Commented Jul 18, 2013 at 13:43
Add a comment
|
3 Answers
i know exactly what u need to Do.Download this Demo for reference.
it has delegate method
- (void)imagePicker:(GKImagePicker *)imagePicker pickedImage:(UIImage *)image{
// add your code here for adding image to Your mutable array and then Reload your tableView.
}
Comments
add notification in which class has table
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(actionremovecalender:)
name:@"subMitReport"
object:nil];
-(void)actionremovecalender:(NSNotification *)notification
{
//table relaod code
}
call to another class
[[NSNotificationCenter defaultCenter] postNotificationName:@"subMitReport" object:self];