http://blog.csdn.net/hwl1314/article/details/26820013
-
/*
-
* UIImage 控件
-
*/
-
UIImage *mUiImage=[UIImage imageNamed:@"post_photo_down.png"];
-
UIImageView *mUiImageView=[[UIImageView alloc]initWithImage:mUiImage];
-
//mUiImageView.frame=CGRectMake(0, 0, mUiImage.size.width, mUiImage.size.height);//设置成原图大小
-
mUiImageView.frame=CGRectMake(10, 30, 300, 100);
-
mUiImageView.backgroundColor=[UIColor redColor];
-
mUiImageView.contentMode=UIViewContentModeCenter;//不缩放图片的大小,显示在中间
-
//mUiImageView.contentMode =UIViewContentModeScaleToFill;//拉伸图片填充到整个区域。
-
//mUiImageView.contentMode=UIViewContentModeScaleAspectFill;//图片被拉伸,比例不变,可能超出imageveiw的大小
-
//mUiImageView.contentMode=UIViewContentModeScaleAspectFit;//图片被拉伸,大的一边填充imageview,小的一边按比例缩小。
-
[self.window addSubview:mUiImageView];
-
[mUiImageView release];
-
-
/*
-
*UiProgressView控件
-
*/
-
UIProgressView *mUiProView=[[UIProgressView alloc]initWithProgressViewStyle:UIProgressViewStyleDefault];
-
mUiProView.frame=CGRectMake(10, 200, 300, 100);
-
mUiProView.backgroundColor=[UIColor whiteColor];
-
mUiProView.progress=0.0;
-
mUiProView.progressTintColor=[UIColor redColor];
-
mUiProView.trackTintColor=[UIColor yellowColor];
-
[mUiProView setProgress:0.8 animated:YES];
-
[self.window addSubview:mUiProView];
-
[mUiProView release];
-
-
/*
-
* UISlider 控件
-
*/
-
UISlider *mUiSlide=[[UISlider alloc]init];
-
mUiSlide.frame=CGRectMake(10, 250, 300, 100);
-
[self.window addSubview:mUiSlide];
-
mUiSlide.backgroundColor=[UIColor blueColor];
-
mUiSlide.maximumValue=101;
-
mUiSlide.minimumValue=100;
-
mUiSlide.minimumValueImage=[UIImage imageNamed:@"post_taskuser.png"];
-
mUiSlide.maximumValueImage=[UIImage imageNamed:@"post_taskuser.png"];
-
mUiSlide.minimumTrackTintColor=[UIColor blueColor];
-
mUiSlide.maximumTrackTintColor=[UIColor blackColor];
-
mUiSlide.thumbTintColor=[UIColor orangeColor];
-
[mUiSlide setValue:100.9 animated:YES];
-
[mUiSlide setThumbImage:[UIImage imageNamed:@"post_taskuser.png"] forState:UIControlStateNormal];
-
//mUiSlide setMaximumTrackImage:<#(UIImage *)#> forState:<#(UIControlState)#>
-
//mUiSlide setMinimumTrackImage:<#(UIImage *)#> forState:<#(UIControlState)#>
-
[mUiSlide release];
-
-
-
/*
-
*Uiswitch控件
-
*/
-
UISwitch *mUiSwitch=[[UISwitch alloc]init];
-
mUiSwitch.frame=CGRectMake(10, 400, 300, 100);
-
mUiSwitch.backgroundColor=[UIColor blackColor];
-
if(mUiSwitch.isOn)
-
{
-
NSLog(@"开关为打开状态");
-
}
-
else
-
{
-
NSLog(@"开关为关闭状态");
-
}
-
mUiSwitch.onTintColor=[UIColor blackColor];
-
mUiSwitch.tintColor=[UIColor blueColor];
-
mUiSwitch.thumbTintColor=[UIColor redColor];
-
// mUiSwitch.onImage=[UIImage imageNamed:<#(NSString *)#>];
-
// mUiSwitch.offImage=[UIImage imageNamed:<#(NSString *)#>];
-
[mUiSwitch setOn:YES animated:YES];
-
[mUiSwitch addTarget:self action:@selector(onclick:) forControlEvents:UIControlEventValueChanged];
-
-
[self.window addSubview:mUiSwitch];
-
[UISwitch release];
版权声明:本文为博主原创文章,未经博主允许不得转载。
阅读(682) | 评论(0) | 转发(0) |