2010-03-08 132 views
0

我的應用程序有三個文本字段: 1)用戶名從iPhone應用程序發佈推文

// Initialization code 
    usernameTextField = [[UITextField alloc] initWithFrame:CGRectMake(20, 5, 280, 30)];//usernameTextField released 

    usernameTextField.placeholder = @"Username"; 
    usernameTextField.textAlignment = UITextAlignmentLeft; 
    //Username text field 
    usernameTextField.backgroundColor = [UIColor clearColor]; 
    usernameTextField.borderStyle = UITextBorderStyleRoundedRect; 
    usernameTextField.autocorrectionType = UITextAutocorrectionTypeNo; 
    usernameTextField.keyboardType = UIKeyboardTypeURL; 
    usernameTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; 

2)密碼

// Initialization code 
    passwordTextField = [[UITextField alloc] initWithFrame:CGRectMake(20, 90, 280, 30)]; 
    passwordTextField.placeholder = @"Password"; 
    passwordTextField.textAlignment = UITextAlignmentLeft; 
    //Password text field 
    passwordTextField.backgroundColor = [UIColor clearColor]; 
    passwordTextField.borderStyle = UITextBorderStyleRoundedRect; 
    passwordTextField.autocorrectionType = UITextAutocorrectionTypeNo; 
    passwordTextField.keyboardType = UIKeyboardTypeURL; 
    passwordTextField.autocapitalizationType = UITextAutocapitalizationTypeNone; 

    passwordTextField.secureTextEntry = YES; 

3)文本查看

textView = [[UITextView alloc] initWithFrame:CGRectMake(5, 10, 310, 180)]; 
    textView.layer.cornerRadius = 8; 
    textView.clipsToBounds = YES; 
    textView.font = [UIFont fontWithName:@"Arial" size:16.0f]; 

什麼最好/快速的方式來使用這些上傳推文直接Twitter,與前兩個登錄細節和鳴叫textView?

回答

3

你應該看看使用MGTwitterEngine。它提供了你需要的一切

身份驗證是那麼容易,因爲

MGTwitterEngine *twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self]; 
[twitterEngine setUsername:@"username" password:@"password"]; 

,然後你只需要使用

- (NSString *)sendUpdate:(NSString *)status; 

發佈一個更新

+2

您可能還需要檢查出的代碼Ben Gottlieb已經在Github上處理Twitter正在轉向的更新的OAuth認證:http://github.com/bengottlieb/Twitter-OAuth-iPhone – 2010-03-08 13:42:59

相關問題