2013-03-07 77 views

回答

0

確定你有VC1 - > VC2

你必須在VC2,使在VC1隱藏按鈕buttonTohide從動作(someAction)

1.增加標頭中的代表協議定義

@protocol CustomDelegate <NSObject> 
    -(void)hideUnhidebutton:(BOOL)value; 
    @end 

2. in VC1.h使VC1成爲代表接收者

@interface VC1<CustomDelegate> 

3. VC1.m 實現該方法來執行buttonhide

-(void)hideUnhidebutton:(BOOL)value 
{ 
[self.buttonTohide setHidden:value]; 

} 

4. 在VC2 加載委託變量作爲屬性

@property (nonatomic, strong) id<CustomDelegate> delegatePpty; 

在VC2 .m在某事你必須隱藏VC1中的按鈕,所以調用刪除門方法

-(void)someAction 
{ 
    [self.delegatePpty hideUnhidebutton:YES];//Call the delegate method to execute 
} 

,它會隱藏編碼:)

+0

我的可能是stubid但出於某種原因,我得到一個壞的接收器類型爲void錯誤,您可以幫助you.Happy按鈕??? – 2013-03-08 16:39:00