button自動檢測 幾個字串之後能點選
阿新 • • 發佈:2019-01-10
UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; [rightBtn setImage:[UIImage themeImageNamed:@"nor"] forState:UIControlStateNormal]; [rightBtn setImage:[UIImage themeImageNamed:@"press"] forState:UIControlStateHighlighted]; [rightBtn addTarget:self action:@selector(clickToPublish) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:rightBtn]; item.enabled = self.model.title.length>0; self.navigationItem.rightBarButtonItem = item;