开发者

Posting Tweets from Iphone App

My app has three text fields: 1) Username

    // 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) Password

    // 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.autocapitaliza开发者_Python百科tionType = UITextAutocapitalizationTypeNone;

    passwordTextField.secureTextEntry = YES;

3) Text View

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

What is the best/quick way to use these to upload tweets to twitter directly, with the login details for the first two and the Tweet being the textView?


You should look into using MGTwitterEngine. It provides everything you need

Authenticating is as easy as

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

and then you just use

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

to post an update

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜