从Iphone App发布推文

时间:2010-03-08 12:57:22

标签: iphone twitter

我的应用有三个文字字段: 1)用户名

    // 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的最佳/快捷方式是什么?前两个的登录详细信息和文本视图的推文是什么?

1 个答案:

答案 0 :(得分:3)

您应该考虑使用MGTwitterEngine。它提供了您需要的一切

验证就像

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

然后你只需使用

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

发布更新