我設置UIButton
爲myButton到隱藏在viewDidLoad
的UIButton不會隱藏/顯示
在splitviewcontroller
我有這樣,當我點擊一個tablecell
,某些項目取消隱藏這對於我textviews
的偉大工程,但我的按鈕給我這個:
ERROR: member reference base type void is not a structure or union
下面是一些代碼片段:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
detailViewController.myButton.hidden= NO;
detailViewController.textView1.hidden= NO;
detailViewController.textView2.hidden= NO;
}
在.h文件中有
@property (strong, nonatomic) DetailViewController *detailViewController;
在
DetailViewController
是在按鈕和textviews
被聲明爲
@interface DetailViewController : UIViewController <UISplitViewControllerDelegate>{
IBOutlet UIButton *myButton;
IBOutlet UITextView *textView1;
IBOutlet UITextView *textView2;
}
@property (strong, nonatomic) IBOutlet UITextView *textView1;
@property (strong, nonatomic) IBOutlet UITextView *textView2;
@property (strong, nonatomic) UIButton *myButton;
-(IBAction)myButtonPressed;
@end
IBAction
myButtonPressed
在DetailViewController.m
是
-(IBAction)myButtonPressed{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
RootViewController *RVC = [storyboard instantiateViewControllerWithIdentifier:@"Root"];
[UIApplication sharedApplication].delegate.window.RootViewController = RVC;
}
任何人有,爲什麼按鈕將不會表現任何想法像其他兩個會?是因爲我給了它IBAction
??
檢查UIButton聲明。它不是以正確的方式。 –