NSPratik NSPratik - 16 days ago 4
iOS Question

Can I customize Login button of Twitter kit in iOS?

I have downloaded a Twitter kit framework and added code to login with Twitter. But, I don't want Login button look like that. I want a custom button for Login. Can I do that ? I only want to use this framework as this also leverages with iOS system account.

Provide me solutions or suggestions please.

Thanks in Advance !!!

Answer

As per the document :

Add the code in your button press :

Objective-C

[[Twitter sharedInstance] logInWithCompletion:^
            (TWTRSession *session, NSError *error) {
  if (session) {
      NSLog(@"signed in as %@", [session userName]);
  } else {
      NSLog(@"error: %@", [error localizedDescription]);
  }
}];

Swift

Twitter.sharedInstance().logInWithCompletion {
                (session, error) -> Void in
    if (session != nil) {
        println("signed in as \(session.userName)");
    } else {
        println("error: \(error.localizedDescription)");
    }
}