2012-02-18 2 views
0

UIButton을 만들고 싶습니다. "UISearchBar cancel button"과 같은 스타일입니다. "UISearchBar 취소 버튼"의 스타일 설정 코드를 알고 싶습니다.동일한 스타일의 UISearchBar 만들기 취소 버튼

제발 가르쳐주세요.

cancelButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
[cancelButton setTitle:@"Cancel" forState:UIControlStateNormal]; 
[cancelButton setFrame:CGRectMake(0,0,100,30)]; 

답변

0

내부에 X가있는 둥근 버튼을 생성한다고 가정합니다.

버튼에 스타일을 설정하기 만하면됩니다. 단추를 만들고 사용자 지정 이미지를 설정해야합니다.

UIImage *image = [UIImage imageNamed:@"yourImage"]; 
[cancelbutton setImage:image forState:UIControlStateNormal]; 

는 문서에서 살펴 보자 : UIButton Class Reference

+0

안녕 가 답장을 보내 주셔서 감사합니다. UINavigationButton도 고려합니다. 그러나 보장은 없습니다. – treefarm