簡體   English   中英

如何從NSMutableArray(iPhone)獲得第一個值?

[英]How to get first value from NSMutableArray (iPhone)?

現在我在簡單的iphone應用程序中工作,我已經在NSMutableArray存儲了一些值,如"{54.399, 196}","{-268.246, 273}". 所以我想在第一個indexpath路徑中得到54.399,如何得到這個,請幫助我

提前致謝

看來你有一個陣列數組,所以它會是:

[[myArray objectAtIndex:0] objectAtIndex:0];

或者使用下標:

myArray[0][0];

編輯

好的,你有一個NSStrings數組。 要做你想做的事(獲得53.399),請執行以下操作:

NSString *myString = [myArray objectAtIndex:0];
NSArray *stringComponents = [myString componentsSeparatedByString:@","];
NSString *myFinalString = [stringComponents objectAtIndex:0];

使用下標:

NSString *myFinalString = [[myArray[0] componentsSeparatedByString:@","][0];

您可以使用

[[arrayObj objectAtIndex:0] objectAtIndex:0];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM