我正在教程http://www.raywenderlich.com/14172/how-to-parse-html-on-ios。@end必須出現在客觀上下文中
這是我的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必須出現在客觀上下文中」
我該怎麼辦? xCode是瘋了還是什麼。
怎麼了?
只要刪除第一個'@ end'並按下Command + B. – Adam
但你知道「結束」的意思嗎? – vikingosegundo