Advertisement
Guest User

Untitled

a guest
May 5th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. [
  2. { "id”:"1”,
  3. "subscription":"1”,
  4. "like”:”20”,
  5. "title”:"ABC”,
  6. "image”:"https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4
  7. ”},
  8. { "id”:"2”,
  9. "subscription":"1”,
  10. "like":"6”,
  11. "title”:"XYZ”,
  12. "image”:"https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4
  13. ”}, { "id”:"3”,
  14. "subscription":"1”,
  15. "like”:"12”,
  16. "title”:"you”,
  17. "image”:"https://www.nasa.gov/sites/default/files/styles/image_card_4x3_ratio/public/thumbnails/image/leisa_christmas_false_color.png?itok=Jxf0IlS4
  18. ”},
  19. ]
  20.  
  21. - (void)viewDidLoad
  22. {
  23. NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
  24. NSString *currentLevelKey = @"PhotoId";
  25.  
  26. if ([preferences objectForKey:currentLevelKey] == _Photo_Id)
  27. {
  28. [like setHidden:NO];
  29. }
  30. else
  31. {
  32. //Dis_like.hidden=YES;
  33. }
  34. }
  35.  
  36. - (IBAction)Like_Button:(id)sender
  37. {
  38. like.hidden=YES;
  39. Dis_like.hidden=NO;
  40. }
  41.  
  42. - (IBAction)Dis_like_Button:(id)sender
  43. {
  44. Dis_like.hidden=YES;
  45. like.hidden=NO;
  46.  
  47. NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults];
  48. NSString *currentLevelKey = @"PhotoId";
  49. Str_Photo_id =_Photo_Id;
  50. [preferences setValue:Str_Photo_id forKey:currentLevelKey];
  51. // Save to disk
  52. const BOOL didSave = [preferences synchronize];
  53. if (!didSave)
  54. {
  55. // Couldn't save (I've never seen this happen in real world testing)
  56. }
  57. else
  58. {
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement