다른 변수에서 alertView에 여러 메시지를 표시하려면 어떻게해야합니까?UIAlertView 다중 메시지 표시
답변
예를 들어, 귀하의 여러 변수에서 원하는 NSString
, 빌드 :
NSString *myTitle = @"xyz";
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: myTitle
message: myMessage
delegate: nil
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[alert show];
[alert release];
제목과 값을 여러 줄로 표시하고 싶습니다. 예를 들어 ... 총 재생 시간 : 30, 총점 : 90 ... 계산 된 값은 이제 해당 제목과 함께 표시해야합니다. 지금 아이디어가 있습니다. ? –
"여러 줄"을 갖기 위해 줄 바꿈 문자 ('\ n')를 메세지 문자열에 추가 할 수 있습니다 : http://en.wikipedia.org/wiki/Newline –
감사합니다. 나는 동적 인 AlertViewController를 만들 수있다 ... 어떤 생각이든 이것을하는 방법? –
NSString *[email protected]"total time played:30\n";
NSString *[email protected]"total score :90\n";
NSString *[email protected]"19/2/20010 12:00:77\n";
NSString *string=[NSString stringWithFormat:@"%@%@%@",string1,string2,string3];
UIAlertView *progressAlert = [[UIAlertView alloc] initWithTitle:@"Hello" message:string delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil];
[progressAlert show];
[progressAlert release];
당신은 살을하실 수 있습니다 :
NSString *foo;
NSString *bar;
NSString *baz;
// ... set values for foo, bar and baz ...
NSString *myMessage = [NSString stringWithFormat:@"%@ %@ %@", foo, bar, baz];
그런 다음 복합 메세지
myMessage
를 사용하도록 경고보기 설정을 귀하의 질문에 조금 더,하지만 귀하의 질문에 대한 이해에서 일하고, 당신은 단지 사용할 수 있어야합니다
- (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ...
UIAlertView 생성자. 그런 다음 변수를 단일 NSString
객체로 연결하고 (NSString*)message
으로 전달하십시오. The
+ (id)stringWithFormat:(NSString *)format, ...
공장 방법은이 작업을 간단하게 만듭니다. reading your options with NSString in the Apple documentation을 권하고 싶습니다.
NSString *[email protected]"Message 1.";
NSString *str2= @"Message 2.";
NSString *str3 = @"Message 3";
NSString *msg=[NSString stringWithFormat:@"%@\n%@\n%@",str1,str2,str3];
FreeCoinsCustomAlert* alert = [[FreeCoinsCustomAlert alloc] initWithTitle:msg
message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alert show];
[alert release];
- 1. UIAlertView 버그 표시
- 2. UIActionSheet를 통해 UIAlertView 표시
- 3. 잠시 후 UIAlertView 표시
- 4. UIAlertView 회전하기
- 5. 회색 상태 표시 줄 벗어남 UIAlertView 스타일
- 6. viewDidDisappear에 UIAlertView 표시 : 버튼이 반응하지 않습니까?
- 7. 메시지 만 표시 ApplicationException에서 메시지
- 8. jQuery를 다중 값 팝업 메시지
- 9. Jquery 다중 알림 메시지
- 10. 상태/메시지 표시
- 11. 쿼리 완료 메시지 표시
- 12. 크리스탈 리포트에 메시지 표시
- 13. 표준 오류 메시지 표시
- 14. 활동 닫기 메시지 표시
- 15. JavaScript를 사용하여 메시지 표시
- 16. 삭제시 확인 메시지 표시
- 17. 표시 플래시 메시지
- 18. PyQt4에서 메시지 표시
- 19. 아이폰 - UITableViewController에 메시지 표시
- 20. 사용자에게 친숙한 메시지 표시
- 21. jQuery UI로 메시지 표시
- 22. android - 메시지 표시 방법
- 23. WebSphere7 MQTopic 다중 메시지 검색
- 24. Django 메시지 프레임 워크 메시지 표시
- 25. UIAlertView 숨기기
- 26. UIAlertView backgroundImage
- 27. 단추가없는 UIAlertView
- 28. Flip UIAlertView
- 29. iPad의 UIAlertView
- 30. UIAlertView 디스플레이가 지연되었습니다.
무엇이 여러 개입니까? 질문을 설명해주세요 .... –
여러 메시지를 말하고있는 것이 무엇입니까 ??? –
은 다른 값과 다른 타이틀을 좋아합니다. 재생 시간과 같이 : 30, 점수 : 90 %. 그리고 다른 라인에 표시하십시오. 지금은 명확합니까? –