2 개의 이미지로 사용자 정의 UIButton을 만들고 있습니다. 그러나 어떤 이유로 제목이 나타나지 않고 버튼이 잘 보이지만 제목이 없습니다.UIButton 레이블이 보이지 않습니다.
_button = [UIButton buttonWithType:UIButtonTypeCustom];
_button.frame = CGRectMake(10, 250, 300, 43);
[_button addTarget:self action:@selector(loginClicked:) forControlEvents:UIControlEventTouchUpInside];
[_button setImage:[UIImage imageWithContentsOfFile:normalButtonImg] forState:UIControlStateNormal];
[_button setImage:[UIImage imageWithContentsOfFile:hoverButtonImg] forState:UIControlStateSelected];
[_button setTitle:@"Login" forState:UIControlStateNormal];
[_button setTitle:@"Login" forState:UIControlStateHighlighted];
[_button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_button setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
[self.view addSubview:_button];
단어가 정확히 선택되지 않았습니다. _ignore_. title은 무시되지 않기 때문입니다. 'image'는 버튼의 바깥쪽에'title'을 넣기 만합니다. 버튼 크기보다 작은 이미지를 사용하면'이미지 '에 의해 오른쪽 방향으로 밀린'제목'을 볼 수 있습니다. – holex
아하, 그것을 완벽하게 작동! –