2012-06-26 2 views
0

저는 xcode로 작업 중이며 URL 링크를 쓰는 데 어려움이 있습니다. 나는 사용자가 작성한 나머지 URL 코드를 채우기를 원한다.사용자가 xcode의 나머지 URL 링크를 채우는 방법?

- (IBAction를)의 OpenURL :

여기서 코드이다 (ID) 송신기 { [UIApplication sharedApplication]의 OpenURL [NSURL URLWithString @ "HTTP : //facebook.com/.... "]]; }

사용자는이 표시됩니다 여기에 주소 쓰기 facebook.com/을 ...

은 "facebook.com/"부분은 레이블과는 "작성하여 여기 주소 ... "은 앱 설정에 입력되는 텍스트 필드입니다. 예를 들어 설정에서 "JJMLS"라고 쓸 수 있으므로 결과는 "facebook.com/JJMLS"입니다.

결과 영역 위에 "openURL"버튼을 사용자 정의/비공개로 설정했습니다.

"http://facebook.com/ (.....)"부분이 사용자가 채울 때 JJMLS 결과를 가져와야하는 부분이라고 xcode에게 어떻게 알릴 수 있습니까 ???

정말 도움이됩니다. 당신이 코드에 대한 질문이 있으면 그냥 의견에 넣어,

- (IBAction)openURL:(id)sender { 

    if(textfield.text == nil){ 

     UIAlertView *noTextAlert = [UIAlertView initWithTitle: @"No text entered!" 
                 message: @"Please enter some text" 
                delegate: self 
              cancelButtonTitle: @"Ok" 
              otherButtonTitles: nil]; 

     [noTextAlert show]; 
    } 

    else{ 

     [[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://facebook.com/%@", textfield.text]]]; 
    } 
} 

:

-JJ

답변

2

는 다음과 같이하십시오. 희망이 도움이!

관련 문제