在名为dict
键值对的字典中是:
"alba\U2019s window"="westindies的模特.";
并发送objectForKey:
我得到像"alba的窗口"的字符串.当我发送如下:
[dict objectForKey:alba的窗口];
我没有得到任何东西,它显示为null.
我有一个像休息的阵列,
NSArray*array = [NSArray arrayWithObjects:@"1.1 something", @"1.2 something else", @"1.3 out of left field", @"1.4 yet another!", nil];
Run Code Online (Sandbox Code Playgroud)
现在,我有一个像休息一样的字符串,
NSString*str = @"1.3";
Run Code Online (Sandbox Code Playgroud)
现在我将发送str.然后它需要在数组中找到str并且它需要返回该文本找到的对象的索引.我需要索引2的内容必须作为输出.任何人都可以共享代码.谢谢预先.
NSMutableArray*array = [[NSMutableArray alloc]init];
NSArray*Somearray = [NSArray arrayWithObjects:1st Object,2ndObject,3rd Object,4th object,5th Object,nil];
Run Code Online (Sandbox Code Playgroud)
在上面的数组中,第一对象,第二对象,第三对象,第四对象,第五对象在每个索引中具有val,内容,结论.
for(int i=0;i<[Somearray count];i++)
{
______________
Here the code is there to give each index ,that is having val,content,conclusion ..
After that val,content,conclusion in each index will be add to Dict..
____________
NSDictionary *Dict = [NSDictionary dictionaryWithObjectsAndKeys:val,@"val",content,@"content",conclusion,@"conclusion",nil];
//Each time adding dictionary into array;
[array addObject:Dict];
}
Run Code Online (Sandbox Code Playgroud)
上面的Dictionary是for循环,keyvalue对将被添加5次(Somearray Count).现在有数组
array = [{val="1.1 this is first one",content="This is the content of 0th index",conclusion="this is the conclusion of 0th index"},{val="1.2 this …
Run Code Online (Sandbox Code Playgroud) 我将创建一个按钮和imageview.我将创建IBAction按钮打开UIImagepicker拍照.我需要之后图像需要在imageview中显示.如何得到这个.任何人都可以帮助我.