Skip to content

Instantly share code, notes, and snippets.

#import <Twitter/Twitter.h>
#import <Accounts/Accounts.h>
@interface MentionViewController ()
- (void)refresh;
@end
- (void)viewDidLoad
{
[super viewDidLoad];
[self refresh];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [statuses count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier];
cell.textLabel.font = [UIFont systemFontOfSize:11.0];
}
- (void)refresh {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *twitterAccountType =
[accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:twitterAccountType
withCompletionHandler:^(BOOL granted, NSError *error)
{
if (!granted) {
NSLog(@"User rejected access to his account.");
}else{
#import <Twitter/Twitter.h>
#import <Accounts/Accounts.h>
- (IBAction)pressSendButton:(id)sender {
ACAccountStore *accountStore = [[ACAccountStore alloc] init];
ACAccountType *twitterAccountType =
[accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
[accountStore requestAccessToAccountsWithType:twitterAccountType
withCompletionHandler:^(BOOL granted, NSError *error)
{
if (!granted) {
NSLog(@"User rejected access to his account.");
}else{
@interface FavoritesViewController : UITableViewController
{
NSMutableArray *statuses;
}