UI development ---- UIController and its subclass, ui ---- uicontroller
// Created By Guo Zai April 17, 2015 23:30:33
This evening's design model was designed to use the initial proxy UIApplicationDeleg of the ios startup process to set page conversion, but it became more and more troublesome. It was implemented in a simple and stupid way, write down the content tomorrow.
============================
There is no time to go directly to the Code:
============================
UIImageView:
// =========================== UIImageView ============================ ================== UIImageView * imageView = [[UIImageView alloc] initWithFrame: CGRectMake (100,200, 50, 50)]; imageView. image = [UIImage imageNamed: @ "3"]; [imageView. layer setShadowColor: [UIColor greenColor]. CGColor]; imageView. layer. shadowOffset = CGSizeMake (5, 5); // sets the opacity imageView. layer. shadowOpacity = 0.5; NSMutableArray * images = [NSMutableArray array]; for (int I = 7; I <13; I ++) {NSString * name = [NSString stringWithFormat: @ "mongod.png", I]; UIImage * img = [UIImage imageNamed: name]; [images addObject: img];} imageView. animationImages = images; // set the animation interval. The imageView must be set before startAnimating. animationDuration = 1; [imageView startAnimating]; // imageView. contentMode = UIViewContentModeScaleAspectFill; // imageView. contentMode = UIViewContentModeTop; // 25 turns my own image into a circle. Here, 25 represents the radius imageView. layer. cornerRadius = 25; [imageView. layer setMasksToBounds: YES]; [self. window addSubview: imageView]; [imageView release];
======================================
UISlider:
# Pragma mark-UISlider * slider = [[UISlider alloc] initWithFrame: CGRectMake (50,200,200, 50)]; slider. minimumValue = 100; slider. maximumValue = 200; // set the slider to stand upside down (vertical) // slider. transform = CGAffineTransformMakeRotation (M_PI_2); // you can specify the slider color for the selected area. minimumTrackTintColor = [UIColor blackColor]; // slider. tintColor = [UIColor redColor]; // you can specify the color slider of the area that has not been crossed. maximumTrackTintColor = [UIColor redColor]; UIImage * img = [UIImage imageNamed: @ "3"]; [slider setThumbImage: img forState: UIControlStateNormal]; slider. thumbTintColor = [UIColor blueColor]; [slider addTarget: self action: @ selector (sliderChanged :) forControlEvents: UIControlEventValueChanged]; [self. view addSubview: slider]; [slider release];
============================================
UISegment:
# Pragma mark-UISegmentedControl NSArray * items = [NSArray arrayWithObjects: @ "Homepage", @ "list", @ "favorites", nil]; UISegmentedControl * seg = [[UISegmentedControl alloc] initWithItems: items]; seg. frame = CGRectMake (30, 50,250, 30); seg. tintColor = [UIColor blackColor]; [seg insertSegmentWithTitle: @ "My page" atIndex: 1 animated: YES]; seg. selectedSegmentIndex = 2; [seg addTarget: self action: @ selector (segClicked :) forControlEvents: UIControlEventValueChanged]; [self. view addSubview: seg]; [seg release];
============================================
UIControl:
Core functions of UIControl:
Add events to the control using the addTarget: action: forControlEvents: Events method.
You can use removeTarget: action: forControlEvents: to remove an event.
============================================
Summary:
UIControl is the base class of all control controls. UISlider is a control that can respond to a sliding event. UISegmentedControl is a single-choice control. In addition to displaying a single image clip, UIImageView can also play a group of images.
============================================
It's too late this time. It's about 12 o'clock ~~~~~~~~~~~~