-4

I am having three buttons in a view. and three actions for three buttons. In the first view i have declared three buttons and three actions for that three buttons. In the next view i have taken table view. And I have taken three mutable arrays. If the first button is pressed the first mutable array items is to be passed into tableview. If the second button is pressed the second mutable array items is to be passed into tableview. If the third button is pressed the third mutable array items is to be passed into tableview. Can anybody give me the code.

4

1 に答える 1

0

その単純な..あなたは単にdatasourcetableViewのを変更する必要があります....cellForRowAtindexPathメソッドで、渡す配列が何であれ、buttonClickイベントでそれを変更してリロードするだけですtableView

これがあなたを助けることを願っています。

追加された編集: forNSNotification

FirstView.m

-(void)buttonAction{

 [[NSNotificationCenter defaultCenter] postNotificationName: @"changeArray" object:yourArray userInfo:nil];

}

SecondView.m

-(void)ViewDidLoad{

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receiveTestNotification:) name:@"changeArray" object:nil];

}


-(void)receiveTestNotification:(NSNotification)iNotification{
      NSMutableArray *myArray = [iNotification object];
    //do your changes.

}
于 2013-09-07T06:14:00.127 に答える