在用于iPhone的Objective-C编码中使用IBAction和IBOutlet的目的是什么,如果我不使用它会有什么不同吗?
据我所知,Objective-C不支持方法重载.在Objective-C中可以替代什么?或者我应该总是使用不同的方法名称?
在将int值放入字典之前我已将int值设置为[NSNumber numberWithInt:2],现在当我尝试检索字典内容时,我希望它以int格式返回.. hw这样做?
这是我的代码;
NSMutabelDictionary *dict = [[NSMutableDictionary alloc]init];
int intValue = 300;
[dict setObject:[NSNumber numberWithInt:intValue] forKey:@"integer"];
Run Code Online (Sandbox Code Playgroud)
retriving .........
int number = [dict ObjectForKey:@"integer"];
Run Code Online (Sandbox Code Playgroud)
..它抛出异常,说铸造是必需的..当我这样做的时候..
int number = (int)[dict ObjectForKey:@"integer"];
Run Code Online (Sandbox Code Playgroud)
它不起作用......
如何解决这个问题呢?/
请建议..
我正在开发一个需要播放视频的iPhone应用程序.到目前为止,我了解到实现这一目标至少有两个API; AVPlayer和MPMoviePlayerController.
有哪些主要区别?
我可以NSDictionary根据钥匙进行排序吗?
如何以编程方式增加UITextField对UIView在iPhone编程?
UITextField* text;
UIView* view = [[UIView alloc]init];
[view addSubview:???];
Run Code Online (Sandbox Code Playgroud) 我有一个字符串,它的值是必须实例化的类[MyClass]的名称,而MyClass有一个名为
-(void)FunctionInClass;
Run Code Online (Sandbox Code Playgroud)
我正在使用名为NSClassFromString的方法来实例化MyClass.我想知道
1) what does NSClassFromString return??
2) what is id?
3) How to call method -(void)FunctioninClass which is in MyClass using the instance.
Run Code Online (Sandbox Code Playgroud)
我该怎么办,我是在Objective-C for iPhone app中做的?
我正在维护一个NSMutableDictionary包含键和值对的东西.现在我需要对其中的每个值执行一些操作.如何从字典中检索值.
// this is NSMutableDIctionary
NSMutableDictionary *dictobj = [[NSMutableDictionary alloc]init];
// in methodA
-(void)methodA
{
//get the value for each key and peform an operation on it.
}
Run Code Online (Sandbox Code Playgroud)
如何进行?请帮助
objective-c ×8
ios ×3
iphone ×3
avfoundation ×1
avplayer ×1
boolean ×1
ibaction ×1
iboutlet ×1
ios4 ×1
ipad ×1
key ×1
nsdictionary ×1
nsnumber ×1
overloading ×1
sorting ×1
uitextfield ×1
uiview ×1