Friday, 27 April 2012

UISlider Customisation

Transparent UISlider:

By default there is a default blue and white, selection for minimum and maximum image in iphone, what if you want a transparent image in them without having those images

Steps:

Add the slider in the interface builder and create an iboutlet for it in the code, then link them together
then in the -viewdidload- method use the following code, to make the UISlider transparent
 
    UIGraphicsBeginImageContextWithOptions((CGSize){ 1, 1 }, NO, 0.0f);    UIImage *transparentImage = UIGraphicsGetImageFromCurrentImageContext();    UIGraphicsEndImageContext();
    [slider setMinimumTrackImage:transparentImage forState:UIControlStateNormal];    [slider setMaximumTrackImage:transparentImage forState:UIControlStateNormal];


This should help you to get a transparent slider without any minimum and maximum images


Customized Minimum and Maximum Images:

If you want to customize it with your own images, then asusual link them together then in the viewdidload method use the following code.

Steps:

  UIImage *minImage = [UIImage imageNamed:@"min.png"];
  UIImage *maxImage = [UIImage imageNamed:@"max.png"];
  UIImage *tumbImage= [UIImage imageNamed:@"slidebutton.png"];  minImage=[minImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
  maxImage=[maxImage stretchableImageWithLeftCapWidth:10.0 topCapHeight:0.0];
  [slider setMinimumTrackImage:minImage forState:UIControlStateNormal];
  [slider setMaximumTrackImage:maxImage forState:UIControlStateNormal];
  [slider setThumbImage:tumbImage forState:UIControlStateNormal];





Tuesday, 20 December 2011

ios5 apps Requiring to support armv6 architechture

By default, ios 5 generally supports only armv7 architecture, to make your apps work on old phones still
you need to support armv6 in your build architecture

following this link
Building armv6 architecture in ios5