0
제목과 다른 모든 속성을 가진 버튼이 세 개 있습니다. 제목은 각각 'A', 'B'및 'C'입니다. 이 세 버튼의 모든 공통 속성을 작성하고이 버튼을 어디서 볼 것인지를 묻는 메소드를 작성했습니다. 나는 모든 논문을 마쳤지 만, 버튼 제목으로 구조화했다. 나는 forses 버튼을보기 위해 추가했다. 내 코드는 다음과 같습니다.ASCII 버튼 제목의 문자열 값
세 가지 공통적 인 버튼이있는 메소드입니다.
-(UIButton *)setMiddlePlayButton{
UIButton * middleButton = [UIButton buttonWithType:UIButtonTypeCustom];
[middleButton setBackgroundImage:[UIImage imageNamed:@"Middle"] forState:UIControlStateNormal];
[middleButton addTarget:self action:@selector(playButtonPressed:)
forControlEvents:UIControlEventTouchDown];
middleButton.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
return middleButton;
}
뷰에 단추를 추가하는 방법으로이 메서드를 호출합니다.
for(int i= 0; i<3; i++){
UIButton * middleButtons = [self setMiddlePlayButton];
middleButtons.tag= 2+i;
//Here I have to add button Title which is 'A' for first button with tag 2, 'B' for second button with tag 3 and 'C' for third button.
[self.view addSubView:middleButtons];
}
제목을 가져 오는 방법을 찾지 못했습니다. ASCII 값으로 가능한 것이 무엇입니까? 아니면 다른 방법이 있습니까? 도와주세요.
덕분에이 코드를 시도, 그것은 :) 작동 – hgpl