JSON地址:如何在Xcode中顯示所選圖像?
{
"status": "200",
"requestType": "productDisplay",
"basePath": "http:\/\/192.168.0.33\/cartwebsite3\/",
"bannerPath": "http:\/\/192.168.0.33\/cartwebsite3\/cdn-images\/banner\/",
"productPath": "http:\/\/192.168.0.33\/cartwebsite3\/cdn-images\/prd\/",
"response": {
"data": [{
"product_id": "3",
"seller_id": "1",
"product_active": "on",
"product_name": "Micromax Unite 3",
"product_alias": "(Blue, 8 GB)",
"product_sku": "21334",
"product_manufacturer_country": "India",
"product_manufacturer": "india",
"product_min_add": "1",
"product_max_add": "100",
"short_description": "Slim, compact and user-friendly, the Micromax Unite 3 is a good combination of powerful performance and nifty features for a great smartphone experience.",
"long_description": "Slim, compact and user-friendly, the Micromax Unite 3 is a good combination of powerful performance and nifty features for a great smartphone experience.",
"product_quantity": "0",
"quantity": "100",
"status": "In Stock",
"price_id": "4",
"mrp_price": "5900.0000",
"selling_price": "5099.0000",
"offer_percentage": "",
"product_weight": "130g",
"offer_selling_price": "2000.0000",
"offer_selling_percentage": "",
"offer_selling_start_date": "1461621600",
"offer_selling_end_date": "1469484000",
"shipping_cost": "0.0000",
"product_images": [{
"image_id": "18",
"product_id": "3",
"image_small": "",
"image_medium": "",
"image_large": "",
"original_res": "micromax-unite-3-951452579749.jpeg",
"image_type": "jpeg",
"added_date": "1452579749",
"added_user": "1",
"sort": "0"
}, {
"image_id": "19",
"product_id": "3",
"image_small": "",
"image_medium": "",
"image_large": "",
"original_res": "micromax-unite-3-241452579749.jpeg",
"image_type": "jpeg",
"added_date": "1452579749",
"added_user": "1",
"sort": "0"
}, {
"image_id": "20",
"product_id": "3",
"image_small": "",
"image_medium": "",
"image_large": "",
"original_res": "micromax-unite-3-301452579749.jpeg",
"image_type": "jpeg",
"added_date": "1452579749",
"added_user": "1",
"sort": "0"
}],
"basic_info": [{
"basic_id": "550",
"product_id": "3",
"option_name": "Features",
"option_description": "Android v5 OS",
"have_connected": "0"
}, {
"basic_id": "551",
"product_id": "3",
"option_name": "Features",
"option_description": "8 MP Primary Camera",
"have_connected": "0"
}, {
"basic_id": "552",
"product_id": "3",
"option_name": "Features",
"option_description": "2MP Secondary Camera",
"have_connected": "0"
}, {
"basic_id": "553",
"product_id": "3",
"option_name": "Features",
"option_description": "Dual Sim (GSM WCDMA)",
"have_connected": "0"
}],
"extra_info": [{
"type": "textfield",
"main_header": "Micromax Unite 3(Blue, 8 GB)",
"field_option": [{
"inside_single_title": "Specifications",
"basic_opt1": [{
"option_name_extra": "In the Box",
"option_desc_extra": "Handset, USB Cable, Charger, User Guide, Warranty Card, Battery, Hands-free"
}, {
"option_name_extra": "Sensors",
"option_desc_extra": "Light Sensor, Gravity Sensor, Proximity Sensor"
}, {
"option_name_extra": "User Memory\t",
"option_desc_extra": "4.9 GB for Apps and Phone Storage"
}, {
"option_name_extra": "Processor",
"option_desc_extra": "1.3 GHz MTK 6582M, Quad Core"
}]
}]
}],
"category_list": [{
"category_id": "46",
"category_name": "ELECTRONICS",
"category_desc": "",
"category_image": "",
"category_thumbnail": "",
"category_image_desc": "",
"category_meta_title": "",
"category_meta_desc": "",
"category_meta_keyword": "",
"category_show_hide": "0",
"category_vanity": "electronics"
}, {
"category_id": "48",
"category_name": "Mobiles",
"category_desc": "",
"category_image": "",
"category_thumbnail": "",
"category_image_desc": "",
"category_meta_title": "",
"category_meta_desc": "",
"category_meta_keyword": "",
"category_show_hide": "0",
"category_vanity": "mobiles"
}, {
"category_id": "54",
"category_name": "Micromax",
"category_desc": "",
"category_image": "",
"category_thumbnail": "",
"category_image_desc": "",
"category_meta_title": "",
"category_meta_desc": "",
"category_meta_keyword": "",
"category_show_hide": "0",
"category_vanity": "micromax"
}]
}]
},
"request": {
"postData": [],
"getData": {
"type": "productDisplay",
"result": "json",
"product_id": "3"
}
}
}
代碼:
-(void)navigateToNextPage :(UITapGestureRecognizer *)gest{
UIImageView *theTappedImageView = (UIImageView *)gest.view;
NSInteger index = theTappedImageView.tag;
ViewController *orderView=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil];
[self.navigationController pushViewController:orderView animated:YES];
self.imgName.image = [imgid objectAtIndex:index];
// orderView.stringcell=[product_id objectAtIndex:index];
}
如何在Xcode顯示相同的圖像所選擇的圖像。圖像已被點擊,但圖像不顯示在輸出中。
你爲什麼要'self.imgName.image'而不是'orderView.imgName'?你沒有給'orderView'顯示任何信息。 – Larme
與此鏈接相同。 http://i.imgur.com/LYBXFVu.png – user2524
http://i.imgur.com/LYBXFVu.png – user2524