我一直在试图寻找任何资源来查找我从文本字段获取的电子邮件地址以获取@符号前的第一部分的任何资源.我曾尝试查看文档,使用componentsseparatedbyString.
没运气.
感谢您的帮助
我试图在越狱的iPhone上的iTunes目录中获取自定义铃声的名称.我可以成功列出自定义铃声,但它们显示为HWYH1.m4r,这是iTunes重命名文件的方式,但我知道这是一种解密歌曲实际名称的方法.
NSMutableDictionary *custDict = [[NSMutableDictionary alloc] initWithContentsOfFile:@"/iPhoneOS/private/var/mobile/Media/iTunes_Control/iTunes/Ringtones.plist"];
NSMutableDictionary *dictionary = [custDict objectForKey:@"Ringtones"];
NSMutableArray *customRingtone = [[dictionary objectForKey:@"Name"] objectAtIndex:indexPath.row];
NSLog(@"name: %@",[customRingtone objectAtIndex:indexPath.row]);
cell.textLabel.text = [customRingtone objectAtIndex:indexPath.row];
Run Code Online (Sandbox Code Playgroud)
dictionary 正在回归:
"YBRZ.m4r" =
{
GUID = 17A52A505A42D076;
Name = "Wild West";
"Total Time" = 5037;
};
Run Code Online (Sandbox Code Playgroud)
cell.textLabel.text 正在回归: name: (null)
数组的每个索引都可以保存NSDictionary吗?
谢谢.
有没有一种简单的方法可以对数组中的一系列对象进行快速枚举?就像是...
for (Object *object in myArray startingAtIndex:50) {
//do stuff
}
Run Code Online (Sandbox Code Playgroud)
......为了避免做这样的事......
for (Object *object in myArray) {
NSUInteger index = [myArray indexOfObject:object];
if (index >= 50) {
//do stuff
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我从Web服务获得数组值.这个数组是1个或多于1个元素的数组.如果tempArra是1个维数的数组然后如果我想将数组中的数据传输到另一个数组(garbageDatesFor01)那么我得到错误
EDIT: returning to the web service responses in 2 ways
RESPONSE 1
(
(
"2011-08-03",
"2011-08-17"
)
)
OR
RESPONSE 2
2011-08-04
NSArray *garbageDatesFor01=[[NSArray alloc] initWithArray:tempArr];
2011-08-26 18:43:35.689 AOK[1846:207] -[NSCFString count]: unrecognized selector sent to instance 0x990d8f0
2011-08-26 18:43:35.691 AOK[1846:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSCFString count]: unrecognized selector sent to instance 0x990d8f0'
*** Call stack at first throw:
(
0 CoreFoundation 0x015d25a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x01726313 objc_exception_throw + 44
2 CoreFoundation 0x015d40bb …Run Code Online (Sandbox Code Playgroud) 我一直在找不到如何将JSON数组转换为NSArray.
我有一个php脚本创建一个转换为JSON的数组,然后将其发送并存储到NSString中,如下所示:
[1,2,3,4]
Run Code Online (Sandbox Code Playgroud)
我的问题是我需要把它变成一个整体的NSArray.如何做到这一点?
谢谢!
任何人都可以帮我解释为什么我的阵列崩溃.
基本上我有两个按钮可以改变imageView中的图像.
H:
@interface CaseStudySecondPageViewController : UIViewController
{
//scroller and back and forward buttons for custom control.
__weak IBOutlet UIScrollView *scroller;
__weak IBOutlet UIButton *back;
__weak IBOutlet UIButton *forward;
//app delegate to return the selected case study from the other controller.
AppDelegate *del;
//variables for displaying the case studies
NSArray *myImageArray;
NSInteger localSelctorInt;
}
//setup a IBOutlet to allow the image to be changed.
@property (weak, nonatomic) IBOutlet UIImageView *logoImage;
@end
Run Code Online (Sandbox Code Playgroud)
L:
更新方法:
-(void)Updater
{
[logoImage setImage:[myImageArray objectAtIndex:localSelctorInt]];
}
Run Code Online (Sandbox Code Playgroud)
上一个和下一个按钮: …
我能够从包含字符串开头和结尾的数组中找到所有值A.
我可以使用-hasPrefix并-hasSuffix从NSString类.
但我找不到任何方法来找到相同的使用NSPredicate类.
请帮帮我.提前致谢.
我有一个包含420个NSA阵列文字的文件.每个阵列都有10到200个NSStrings.文件大小为988 KB.
当编译器不进行优化时,它可以构建并运行良好.但是,当我尝试制作存档时,它会挂起"分析86个文件中的86个".我怀疑是因为编译器在优化文件时遇到困难.我将文件分成两部分,它将在大约一个小时的编译后存档.
我将数组放入字典中,然后返回我想要的一个数组.我认为这就是编译器的问题.
-- 420 NSArrays ...
NSArray *foils_easy = [NSArray arrayWithObjects:a_easy, about_easy, ... you_easy, your_easy, nil];
NSArray *keys = @[@"a", @"about", ... @"you", @"your"];
NSDictionary *allFoils = [NSDictionary dictionaryWithObjects:foils_easy forKeys:keys];
return [allFoils objectForKey:target];
Run Code Online (Sandbox Code Playgroud)
我不需要字典,除了确定返回哪个数组.有没有办法构造数组名称,以便可以返回?也许像你这样的东西可以用来在屏幕上放置图像?
NSString *foregroundImageName = [NSString stringWithFormat:@"%@ForegroundL1", scene];
Run Code Online (Sandbox Code Playgroud)
我真的不想投入420'if'语句所以我希望有更好的解决方案.
在myProj.h文件中,我声明了:
@property (strong, nonatomic) NSMutableArray *wordsArray;
Run Code Online (Sandbox Code Playgroud)
在.m文件中,我使用以下命令在viewDidLoad中添加一些值:
[_wordsArray addObject:[NSString stringWithFormat:@"Now is the time for all good men to come to the aid of their party."]];
[_wordsArray addObject:[NSString stringWithFormat:@"Four score and seven years ago our forefathers..."]];
[_wordsArray addObject:[NSString stringWithFormat:@"A coward dies many deaths; a brave man but one."]];
Run Code Online (Sandbox Code Playgroud)
我还在这里设置了一个计数器(在.h文件中定义为int):
__cntr = 0;
Run Code Online (Sandbox Code Playgroud)
在(IBAction)pressButton:(id)发送者我想将标签(*somelabel)文本更改为数组[0]中的下一个值(然后将_cntr迭代为1并获取该值等).所以我有:
_somelabel.text = [NSString stringWithFormat:@"%@",[_wordsArray objectAtIndex:__cntr]];
Run Code Online (Sandbox Code Playgroud)
构建,但是当我运行并按下按钮时,标签文本变为(空).
将数值添加到数组或将其拉出的问题也是如此.谢谢
nsarray ×10
objective-c ×8
ios ×7
iphone ×3
nsstring ×3
cocoa ×1
collections ×1
jailbreak ×1
json ×1
key ×1
nsdictionary ×1
nspredicate ×1
plist ×1