您好,我是新來的iPhone開發如何使用上表視圖文本框顯示解析JSON
我使用的是web服務與那裏我得到JSON響應字符串連接和我解析JSON使用JSONvalue和我responsetring正在使用顯示按鈕,標籤上的解析的JSON ...
當我按一下按鈕解析JSON它會顯示在標籤領域..
我的問題是可以通過v有一個文本框,按鈕和網頁流量或桌面在用戶界面..
當我在文本字段中輸入特定的方法作爲json文件是巨大的,並按下按鈕shd在web視圖或表格視圖上顯示特定方法的內容..
這是可能的嗎?如果是的話如何實現?
感謝ü
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
[connection release];
NSString *responseString = [[NSString alloc] initWithData:dataWebService encoding:NSUTF8StringEncoding];
self.dataWebService = nil;
NSArray* latestLoans = [(NSDictionary*) [responseString JSONValue] objectForKey:@"loans"];
[responseString release];
NSDictionary* loan = [latestLoans objectAtIndex:0];
//fetch the data
NSNumber* fundedAmount = [loan objectForKey:@"funded_amount"];
NSNumber* loanAmount = [loan objectForKey:@"loan_amount"];
float outstandingAmount = [loanAmount floatValue] - [fundedAmount floatValue];
NSString* name = [loan objectForKey:@"name"];
NSString* country = [(NSDictionary*)[loan objectForKey:@"location"] objectForKey:@"country"];
//set the text to the label
label.numberOfLines = 0;
label.text = [NSString stringWithFormat:@"Latest loan: %@ \n \n country: %@ \n \n µamount $%.2f", name,country,outstandingAmount];
您可以嘗試更改您的問題嗎?我不明白你的意思。 – darksky
@Nayefc其實我目前有一個按鈕和UI中的標籤,當我按下按鈕時,它顯示的結果是LABEL..ie,它從JSON文件中獲取並使用解析json在LABEL上顯示...其實我的需求是我的shd在UI中有一個Textfield,按鈕和一個webview ...當我在TextField中輸入一個字符串時,它從JSon文件中搜索例如上面代碼中的「貸款」。它的內容shd在webview中顯示...你有它? – Abhilash