당신 만의 Obj에 C 1) 생성 버튼 extactly 무엇 폭과 높이를 원하는뿐만 아니라 X와 Y 2) 이미지
UIButton *LoginButton = [UIButton buttonWithType:UIButtonTypeCustom];
[LoginButton addTarget:self action:@selector(yourLoginActionMethod) forControlEvents:UIControlEventTouchUpInside];
[LoginButton setFrame:CGRectMake(0, 0, 32, 32)];
UIButton *createAccount = [UIButton buttonWithType:UIButtonTypeCustom];
[createAccount addTarget:self action:@selector(yourSettingMethod) forControlEvents:UIControlEventTouchUpInside];
[createAccount setFrame:CGRectMake(44, 0, 32, 32)];
UIImageView *loginImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
UIImageView *settingImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
UIView *rightBarButtonItems = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 76, 32)];
[rightBarButtonItems addSubview:LoginButton];
[rightBarButtonItems addSubview:createAccount];
[rightBarButtonItems addSubview:loginImg];
[rightBarButtonItems addSubview:settingImage];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:rightBarButtonItems];
당신이 달성 할 수와 같은 수행 도와 드릴까요 그것도 UIButton & 이미지 & lable을 추가하여 – iPatel
@iPatel 시도했지만 올바른 구문으로 신속하게 그렇게하지 못했습니다. –
@AbhishekMitra 가장 간단한 방법은 하나의 UIView를 만들고이 모든 것을 함께 배치 한 다음 customView init을 사용하여 baritem을 생성하는 것입니다. –