gpt4 book ai didi

objective-c - Objective-C 类中的不完整实现

转载 作者:搜寻专家 更新时间:2023-10-30 20:00:57 25 4
gpt4 key购买 nike

这是我的 ViewController.h,它非常简短,所以我认为它可以工作。

//
// 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 的 ViewController.h 中实际实现 - (IBAction)Button: (id)sender; 方法:

- (IBAction)Button: (id)sender{
// Do things here
}

关于objective-c - Objective-C 类中的不完整实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8613162/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com