-
Xcode - button title 변경 및 체크 박스 구현Code/XCODE 2012. 2. 15. 12:45StoryBoard
- Button 삽입 ( 체크 박스 사이즈 )
- Inspector ( 연결 들 )
- Touch Up Inside - ViewContorller - chagneButtonText (연결 )
- Referencing Outlets - ViewContorller - autoLoginButton (연결 )
참조. 1
구현ViewController.h
@interface ViewController : UIViewController{
IBOutlet UIButton *autoLoginButton;
}
@property (retain, nonatomic) UIButton *autoLoginButton;
- (IBAction)changeButtonText:(id)sender;
@end
ViewController.m
@synthesize autoLoginButton;
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (IBAction)changeButtonText:(id)sender{
if(autoLoginButton.titleLabel.text == @"V"){
[autoLoginButton setTitle:@"" forState: UIControlStateNormal];
autoLoginButton.titleLabel.text = @"";
} else {
[autoLoginButton setTitle:@"V" forState: UIControlStateNormal];
}
NSLog(autoLoginButton.titleLabel.text);
}
- 버튼 클릭스 화면 변화
1. 초기 2. 체크 3. 초기
'Code > XCODE' 카테고리의 다른 글
Xcode - 키보드 종료(사라지기) (0) 2012.02.17 Object-C 기본 (0) 2011.06.26