這是我的ViewController.h,它非常簡短,所以我認爲這會起作用。Objective-C類中的不完整實現
//
// ViewController.h
// Blue Bird
//
// Created by Chandler Davis on 12/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <Twitter/Twitter.h>
@interface ViewController : UIViewController
- (IBAction)Button: (id)sender;
@end
,這是我ViewController.m,它告訴我,「實施是不完整的」。我究竟做錯了什麼?
//
// ViewController.m
// Blue Bird
//
// Created by Chandler Davis on 12/23/11.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import "ViewController.h"
@implementation ViewController
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
}
- (void)viewDidDisappear:(BOOL)animated
{
[super viewDidDisappear:animated];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if ([TWTweetComposeViewController canSendTweet]) {
TWTweetComposeViewController *tweetComposer = [[TWTweetComposeViewController alloc]
init];
[tweetComposer setInitialText:@"twit"];
[self presentModalViewController:tweetComposer animated:YES];
}
else {
UIAlertView *alertView = [[UIAlertView alloc]
initWithTitle:@"error" message:@"unable to send tweet" delegate:self cancelButtonTitle:@"ok" otherButtonTitles: nil];
[alertView show];
}
return 0;
}
@end
在程序中我應該實現這個嗎? –
在ViewController.m文件中,'@implementation ViewController'和'@ end'之間的任何位置。 – kasrak
謝謝!對此,我真的非常感激。 –