【发布时间】:2012-08-30 17:29:54
【问题描述】:
我正在关注http://www.raywenderlich.com/14172/how-to-parse-html-on-ios 的教程。
这是我的 detailviewcontroller.h 文件。
#import <UIKit/UIKit.h>
@end <-- //errors shows up here.
@interface DetailViewController : UIViewController
@property (strong, nonatomic) id detailItem;
@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
@end
这是我的 detailview.m 文件
#import "DetailViewController.h"
@interface DetailViewController ()
- (void)configureView;
@end
@implementation DetailViewController
#pragma mark - Managing the detail item
- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
_detailItem = newDetailItem;
// Update the view.
[self configureView];
}
}
- (void)configureView
{
// Update the user interface for the detail item.
if (self.detailItem) {
self.detailDescriptionLabel.text = [self.detailItem description];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self configureView];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
self.title = NSLocalizedString(@"Detail", @"Detail");
}
return self;
}
@end
正如我上面提到的,@end 错误消息出现并等待自动修复红色方块,我同意进行自动修复。然后 xCode 在那里应用 @end 代码,如 .h 文件中所示。然后出现另一个错误,标题为“@end 必须出现在objective-c 上下文中”
我该怎么办? xCode 疯了还是怎么了。
怎么了?
【问题讨论】:
-
只需删除第一个
@end,然后按Command+B。 -
但是你知道“结束”的意思吗?