First day:
1. If a method , only need to click Button Trigger , do not need to call elsewhere , then You do not need to declare in . h only to be implemented in . M
2. for controls ( Properties ) that need to be used only in Viewcontroller , We generally declare that in a class extension,UI controls , all using the weakui control need to be wired , you also need to add iboutlet
3. Convert the text of the textbox to a number: [self.field.text intvalue];
4. Close the keyboard: cancels the first response , cancels the focus of the text box
Method 1: need to find the corresponding Control , to invoke the method , more cumbersome
Self.field1 Resignfirstresponder];
Way 2: Cancel directly Controller's View the editing state
[self. View endediting:YES];
5. UI interface , We can see all the things that are UIView
All controls , either directly or indirectly, inherit UIView
UIView is a container , you can add other controls inside.
we can pass UIView to make some of the purest interfaces.
6. I. A . Common Properties of UIView
* Superview: Parent Control
* Addsubview: adding child controls in a way that uses code
* Frame Properties : CGRect type : determines the position and size of the control
two . use of Uicolor
* can be directly through the class method get a solid color For example red Green and so on [uicolor redcolor][uicolor Blackcolor]
* available through [uicolorcolorwithred:randomr green:randomg blue:randomb alpha:1]; to create a color through Red , Green , Blue Three kinds to make a new color.
* (View) the color :
column: float randomr =arc4random_uniform (255)/255.0;
[Uicolor colorwithred:randomr Green:randomGblue:randomB alpha:1];
7. You cannot directly modify the frame Property of a control to save the frame Property on a temporary variable , and then modify , in the assignment.
8. I. A. Animate the way you modify Frame one -tail animation , If you set the animation time , You can not submit , This animation way , not much to use. , General use Block .
* Start Animation: [UIView BeginAnimations:nilcontext:nil];
* modify various properties of an animation : [UIView Setanimationduration:3];
[UIView Setanimationdelay:2];
* assign a value back: Creaeview.frame=oldframe;
* Commit animations: [UIView commitanimations];
two. animate the way to modify frame-block animations More Select this one way to make
* Write code in block that requires animation :
[UIView Animatewithduration:3 animations:^{
Creaeview.frame=oldframe;
}];
9. I. A . note Point of the button
* Image property can set the picture of the button so that the picture with the text peer
* The default type of the button is system when the image is set Custom We generally use custom
* set background picture , is at the back of the text
* buttons are available in a number of States
default : You can set a style
Click to highlighted: You can set a different style
selected: need to use code settings
Disable: disabled State
* Use code to create a button if you want to set the style of different states , you need to set up separately , The code is large
* Add a Click event using code Addtarget Method: [btn addTarget: Self action:@selector(dosomething) forControlEvents: UIControlEventTouchUpInside];
* When creating a button General Selection directly Create and set It's type : Create UIbutton :
UIButton *btn =[uibuttonbuttonwithtype:uibuttontypecustom];
two . the way the picture resources are located
* can be placed directly in the project
* put in assets.xcassets , note : xcode6 : Image.xcassets
iOS basic Knowledge--01