ios - Xcode Display Image if there is no image on Imageview -
i need make this
iboutlet uiimageview *imageview; iboutlet uiimageview *imageview2; if(imageview have no image){ set image @"x"; }else if(imageview2 have no image){ set image @"x"; }
and save , load code nsuserdefaults
try this
uiimageview *myimageview; if(myimageview.image){ myimageview.image = [uiimage imagenamed:@"myimage1"]; //image exists } else { myimageview.image = [uiimage imagenamed:@"myotherimage"]; //image doesnt exists } //by time image or other set save image [[nsuserdefaults standarddefaults]setobject:myimageview.image forkey:@"myimage"];
i dont know if nsuserdefault can set image object coz havnt tried u might exception, best if can save image's name right in if statement using [[nsuserdefaults standarddefaults] setobject:@"imagenameoftheimage" forkey:@"myimagename]"
Comments
Post a Comment