ios - Changing the background image using UISwitch -
hi im working on simple app changing background image using uiswitch
.
the problem on device pictures in original size. i'm using 960 x 640 png's, should fine on device huge.
thats using.
- (ibaction)changedstate:(uiswitch*)sender { uiswitch *switchvalue = (uiswitch*)sender; [self settorchon:[switchvalue ison]]; if(switchvalue.on) { // lights on self.view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"latarka_4_on.png"]]; } else { // lights off self.view.backgroundcolor = [uicolor colorwithpatternimage:[uiimage imagenamed:@"latarka_4_off.png"]]; } }
make sure have 2 sets of images.-
latarka_4_on.png latarka_4_off.png
for sd resolution (480 x 320). and
latarka_4_on@2x.png latarka_4_off@2x.png
for hd resolution (960 x 640)
chances going wrong if have pngs no suffixes @2x
retina resolution.
Comments
Post a Comment