アットウィキロゴ

子から親への値渡し

@protocol selectDelegate;// デリゲート プロトコルを宣言
 
@interface ChildViewController : UIViewController
id <selectDelegate> delegate_;
@end
 
@property (nonatomic,weak ) id <selectDelegate> delegate_;
 
// ChildViewController.m
 
@synthesize delegate_;
 
[delegate_ childSelect:@"aaa"];
 
// ParentViewController.h
@protocol ColorSelectDelegate
-(void)selectColor:(UIColor*)inColor; // デリゲートメソッド
@end
 
// ParentViewController.m
ChildViewController *view = [[ChildViewController alloc]
                                            initWithNibName:@"ChildViewController" bundle:nil];
view.delegate_ = self;
 
-(void)childSelect:(NSString*)str {
 
}

タグ:

+ タグ編集
  • タグ:
最終更新:2012年09月10日 13:38
ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。