我想知道如何使用三角函数(一个例子会有所帮助),以及我必须导入以使用它们.他们是在用之类的东西math.h中pow()和sqrt()?
有一种UIViewController方法-(void)viewDidUnload.我尝试放入NSLog("unloaded");那里以查看视图何时被卸载,但没有任何内容打印到控制台.
我在哪里放置代码,以便在视图卸载之前我可以执行操作?
我定义了以下属性:
@property (nonatomic, retain) NSString *name_;
@property (nonatomic, retain) NSString *profilePicture_;
@property (nonatomic, retain) NSString *username_;
@property (nonatomic, retain) NSString *id_;
Run Code Online (Sandbox Code Playgroud)
我把它们设置在我init...这样的:
-(id)initWithData:(NSDictionary *)data
{
self = [super init];
if (!self) {
return nil;
}
name_ = [data valueForKey:@"full_name"];
profilePicture_ = [data valueForKey:@"profile_picture"];
username_ = [data valueForKey:@"username"];
id_ = [data valueForKey:@"id"];
return self;
}
Run Code Online (Sandbox Code Playgroud)
以下内容dealloc:
-(void)dealloc
{
[name_ release];
[username_ release];
[profilePicture_ release];
[id_ release];
[super dealloc];
}
Run Code Online (Sandbox Code Playgroud)
但是dealloc给了我一个错误:
正在释放的指针未分配
为什么是这样?我必须做的[[NSString alloc] init...] …
我收到一个错误:
将C指针类型'ABRecordRef'(又名'const void*')隐式转换为Objective-C指针类型'id'需要桥接转换
从这段代码,尝试添加ABRecordRef一个NSMutableArray
ABRecordRef person = (__bridge ABRecordRef)[contactArr objectAtIndex:i];
[addressBookArray addObject:person];
Run Code Online (Sandbox Code Playgroud)
addressBookArray 被定义为
NSMutableArray *addressBookArray;
Run Code Online (Sandbox Code Playgroud) 我最近提交了我的应用程序,Apple拒绝了它,因为我使用了:'AppName iPhone Edition'
通过阅读他们的条款和条件似乎是正确的,但他们告诉我,我不能在设备上显示的名称中使用iPhone.
所以,问题是,当我在构建设置中更改产品名称时,它会要求我提供新的配置文件.我是否需要创建新的配置文件,还是只需更改设备上显示的应用程序名称?
我正在调用一个布尔值的块.根据调试器,布尔值为false,但似乎被视为true.这是一个编译器/ Xcode错误,还是我应该以某种方式标记传递给块的参数__block?
// Hovering over the |finished| parameter displays the value of finished as NO
[self.repDataSynchronizationClient synchronizeWithRepId:rep.id andCompletion:^(NSString * progressMessage, BOOL finished){
if( finished )
{
[self hideLoader]; // Breakpoint set here, which I am hitting
}
else
{
[self setLoaderTitle:progressMessage];
}
}];
Run Code Online (Sandbox Code Playgroud)
这是情况的屏幕截图,其中显示了断点命中和工具提示.
我试图检查对象NSMutableArray与另一个对象的碰撞(使用a CGRect),但它一直说这个方法需要一个标量类型?!
这是抛出错误的方法:
-(void) checkSquareToCircleCollisions{
NSMutableArray *array = [squares getSquares];
for(int i = 0; i < [squares getCount]; i++){
Square *s = [array objectAtIndex: i];
CGRect rect1 = [player getRect];
CGRect rect2 = [s getRect];
//if(CGRectIntersection(rect1, rect2)){
//[player setAlive: NO];
// }
}
}
Run Code Online (Sandbox Code Playgroud) 从NSIndexSet中删除重复索引的最佳方法是什么?例如,假设我的NSIndexSet如下所示:
[ 1, 3, 3, 6, 7, 12, 12, 12 ]
Run Code Online (Sandbox Code Playgroud)
我希望它看起来像:
[ 1, 3, 6, 7, 12 ]
Run Code Online (Sandbox Code Playgroud)
实现这一目标的最有效方法是什么?
我购买了一台配备Mac OS X Lion 10.7.1的Mac笔记本电脑.现在我想开发iPhone应用程序,所以我想知道哪个Xcode版本支持它有故事板设施.
objective-c ×7
cocoa-touch ×3
xcode ×3
abrecord ×1
debugging ×1
ios ×1
nsindexset ×1
osx-lion ×1
properties ×1
xcode4.2 ×1