0

我有一个具有 ivar 的单例对象,该对象NSMutableArray将图像全局保存到应用程序中。我有一个UITableViewController类,它表示附加到消息的图像。我接下来要做的是:当用户从相机胶卷中选择图像时,它们会被添加到该单例的数组中。我想立即重新加载tableviewUITableViewController的以显示这些新消息。我该如何实施?我应该为此使用键值观察吗?如果是,我该怎么做?(我应该通知何时将新对象添加到数组中)。或者可能有其他更正确的方法?

4

3 回答 3

1

我确切地知道你需要做什么。下载此 Demo以供参考。

它有委托方法

    - (void)imagePicker:(GKImagePicker *)imagePicker pickedImage:(UIImage *)image{

     // add your code here for adding image to Your mutable array and then Reload your tableView.

      }
于 2013-07-18T14:00:23.140 回答
0

NSNotification当您希望视图重新加载时发送一个怎么样?

UITableView可以接收通知并重新加载数据。

于 2013-07-18T13:38:41.360 回答
0

添加类有表的通知

 [[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];
于 2013-07-18T13:50:57.390 回答