我在我的模型的实现文件中有一个错误,我已经注释掉了.我该怎么做才能解决这个问题?
提前致谢.
#import "CalculatorBrain.h"
@interface CalculatorBrain()
@property (nonatomic, strong) NSMutableSet *operandStack;
@end
@implementation CalculatorBrain
@synthesize operandStack = _operandStack;
- (NSMutableArray *)operandStack
{
if (!_operandStack) {
_operandStack = [[NSMutableArray alloc] init];
}
return _operandStack;
}
-(void)pushOperand:(double)operand
{
NSNumber *operandObject = [NSNumber numberWithDouble:operand];
[self.operandStack addObject:operandObject];
}
- (double)popOperand
{
NSNumber *operandObject = [self.operandStack lastObject]; // No visible interface for 'NSMutableSet' declares the selector 'lastObject'
if(operandObject) [self.operandStack removeLastObject]; // No visible interface for 'NSMutableSet' declares the selector 'removeLastObject'
return [operandObject doubleValue];
}
- …
Run Code Online (Sandbox Code Playgroud) 在.h文件中添加了两个属性:
@property (assign, nonatomic, readonly) float weightInLbs;
@property (strong, nonatomic, readonly) NSDate *date;
Run Code Online (Sandbox Code Playgroud)
它们会生成此Xcode错误:自动属性合成正在合成未明确合成的属性
我正在运行Xcode 5.1并且我的目标是iOS 7.1.
这意味着什么,我需要做些什么呢?
Xcode 4.2 不再具有基于导航的应用程序模板。
开始项目时我应该用什么来代替?
我试图让UITableView显示我创建的headerView.xib,但在构建之后,没有任何显示.想要使UITableView可编辑,并为ItemsViewController.m文件添加了三个方法,但没有显示.
怎么了?提前致谢.
以下是相关文件:
ItemsViewController.h
#import <Foundation/Foundation.h>
@interface ItemsViewController : UITableViewController
{
IBOutlet UIView *headerView;
}
-(UIView *)headerView;
-(IBAction)addNewItem:(id)sender;
-(IBAction)toggleEditingMode:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
ItemsViewController.m
#import "ItemsViewController.h"
#import "BNRItemStore.h"
#import "BNRItem.h"
@implementation ItemsViewController // Incomplete implementation
-(id)init
{
// Call the superclass's designated initializer
self = [super initWithStyle:UITableViewStyleGrouped];
if (self) {
for(int i = 0; i < 5; i++) {
[[BNRItemStore sharedStore]createItem];
}
}
return self;
}
-(id)initWithStyle:(UITableViewStyle)style
{
return [self init];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[[BNRItemStore sharedStore]allItems]count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView …
Run Code Online (Sandbox Code Playgroud) 我得到这个编译错误,但无法弄清楚原因.评论错误消息.
float remainingAngle(float angleA, float angleB);
{ // Expected identifier or '('
return 180 - (angleA + angleB);
}
int main (int argc, const char * argv[])
{
float angleA = 30.0;
float angleB = 60.0;
float angleC = remainingAngle(angleA, angleB);
printf("The third angle is %.2f", angleC);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我在我的实现页面上收到了一个不完整的实现警告,我已经注释掉了:
#import "BIDDatePickerViewController.h"
@implementation BIDDatePickerViewController // Incomplete implementation
@synthesize datePicker;
- (IBAction)buttonPressed:(id)sender
{
NSDate *selected = [datePicker date];
NSString *message = [[NSString alloc] initWithFormat:@"The date and time you selected is:%@", selected];
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Date and Time Selected"
message:message
delegate:nil
cancelButtonTitle:@"Yes I did"
otherButtonTitles:nil];
[alert show];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSDate *now = [NSDate date];
[datePicker setDate:now animated:NO];
}
- (void)viewDidUnload
{
[super viewDidUnload]; …
Run Code Online (Sandbox Code Playgroud) 我试图配置一个双组件选择器,并得到一些我已经注释掉的错误:
实施文件:
#import "BIDDoubleComponentPickerViewController.h"
@implementation BIDDoubleComponentPickerViewController
@synthesize doublePicker;
@synthesize fillingTypes;
@synthesize breadTypes;
- (IBAction)buttonPressed:(id)sender
{
NSInteger fillingRow = [doublePicker selectedRowInComponent:kFillingComponent]; // Use of undeclared identifier 'kFillingComponent'
NSInteger breadRow = [doublePicker selectedRowInComponent:kBreadComponent]; // Use of undeclared identifier 'kBreadComponent'
NSString *bread = [breadTypes objectAtIndex:breadRow];
NSString *filling = [fillingTypes objectAtIndex:fillingRow];
NSString *message = [[NSString alloc]initWithFormat:@"Your %@ on %@ bread will be right up", filling, bread];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Thank you for your order"
message:message
delegate:nil
cancelButtonTitle:@"Great!"
otherButtonTitles:nil];
[alert show];
}
- …
Run Code Online (Sandbox Code Playgroud) 我试图使用"python ex18.py"命令从电子书学习Python硬盘中运行此文件,但它不输出任何内容.怎么了?
# this one is like your scripts with argv
def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
# ok, that *args is actually pointless, we can just do this
def print_two_again(arg1, arg2):
print "arg1: %r, arg2: %r" % (arg1, arg2)
# this takes just one argument
def print_one(arg1):
print "arg1: %r" % arg1
# this one takes no arguments
def print_none():
print "I got nothin'."
Run Code Online (Sandbox Code Playgroud) 当我使用故事板并从Interface Builder中的对象库中拖出导航控制器时,随nav控制器一起提供的根视图控制器始终是一个表视图控制器.
大多数时候,我只想要一个简单的视图控制器.有没有办法拖出导航控制器,并将一个简单的视图控制器设置为默认值,而不是我现在得到的表视图控制器?
提前致谢!
主文件中的标准参数是什么.我想我在主文件中设置了错误的标准参数,需要更改它们.我认为问题是UIApplicationMain参数中的nil和nil.
这是我的代码:
#import <UIKit/UIKit.h>
int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
Run Code Online (Sandbox Code Playgroud)
错误代码:
Attaching to process 1420.
2011-09-02 14:33:04.440 HypnoTime[1420:207] *** Assertion failure in UIApplicationMain(), /SourceCache/UIKit_Sim/UIKit-1448.89/UIApplication.m:1359
2011-09-02 14:33:04.588 HypnoTime[1420:207] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unable to instantiate the UIApplication delegate instance. No class named AppDelegate is loaded.'
*** Call stack at first throw:
(
0 CoreFoundation 0x00dc15a9 __exceptionPreprocess + 185 …
Run Code Online (Sandbox Code Playgroud)