これは私の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であなたのViewController.hに定義されて- (IBAction)Button: (id)sender;
方法を実装する必要があり
//
// 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
ありがとう!ほんとうにありがとう。 –