메이크업이 간단한 3 단계
1 쓰기 속성 :
@property (nonatomic, strong) IBOutlet UIToolbar *toolBarActive;
@property (nonatomic, strong) IBOutlet UIButton *uiButton;
@property (nonatomic, strong) IBOutlet UIBarButtonItem *uiButtonItem;
이 합성 :
@synthesize toolBarActive = _toolBarActive;
@synthesize uiButton = _uiButton;
@synthesize uiButtonItem = _uiButtonItem;
3 쓰기 구현 : 이제
-(UIToolbar *) toolBarActive {
if(_toolBarActive == nil) {
_toolBarActive = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 380, 320, 40)];
_toolBarActive.tintColor = [UIColor blackColor];
NSMutableArray *arrayItem = [[NSMutableArray alloc] init];
[arrayItem addObject:self.uiButtonItem];
[_toolBarActive setItems:arrayItem animated:YES];
}
return _toolBarActive;
}
- (UIButton *) uiButton {
if(_uiButton == nil) {
_uiButton = [[UIButton alloc] initWithFrame:CGRectMake(5, 5, 50, 50)];
[_uiButton addTarget:self action:@selector(deletePointFromTrip) forControlEvents:UIControlEventTouchUpInside];
[_uiButton setImage:[UIImage imageNamed:@"editable.png"] forState:UIControlStateNormal];
}
return _uiButton;
}
- (UIBarButtonItem *) uiButtonItem {
if(_uiButtonItem == nil) {
_uiButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.uiButton];
[_uiButtonItem setEnabled:YES];
}
return _uiButtonItem;
}
당신이 가지고있는 UIButton uibarbuttomitem에서 uibutton like, image, action 등의 모든 속성을 정의 할 수 있습니다.
먼저 게시했지만 Octo의 답변이 더 완전했습니다. 나는 체크 표시를 나눌 수 있었으면 좋겠다. 그러나 나는 당신의 게시물을 통찰력이있는 것으로 생각하고 그들에게 그들이 받아야하는 업보를주었습니다. – Mytheral