1. Change the button font size: (In fact, the text inside the button is added to the label)
Button.titleLabel.font = [Uifont systemfontofsize:];
How to change the label:
Label.font = [Uifont systemfontofsize:];
2. Change the point of a control (including a frame, bounds, center, etc.) can not be directly assigned to the value below, to declare a temporary variable to save, change the temporary variable points and then assign the whole frame back. Because a view uses a dot syntax (that is, ". Frame") After: ". Size", which is not the member variable that accesses the view, but rather accesses the members inside the struct, which is not allowed in OC.
num.center.x = self.view.center.x; This line code error
The correct approach is as follows
If you want to change the Y value cannot be changed directly, you must use a temporary rect to change
CGRect Tempframe === tempframe;
Someone here will ask: if you want to change the point in the frame of a view or control in the future development, that's not very troublesome? , here is a little tips, you can write a classification for UIView Oh, the following is an example:
Declare the attribute in the. h file,
@property (Assign, nonatomic) CGFloat x;
Override setter methods in. m files,
-(void) SetX: (cgfloat) x{ = self.frame; = x; = frame;}
In this way, it can be used as a direct
ten;
It would be a lot easier to use, right? The other Y-values, the wide-height should not I go to say it? You're not going to write it? After the classification is pulled directly into the project to be developed, this modified frame value is much more cool.
3. Center the text in the label
Label.textalignment = Nstextalignmentcenter;
Word wrap in 4.label, 0 for multiple lines.
0;
5. Set the stretch mode of the picture (multiple properties are optional, the right is an enumeration, you can commom the mouse and click inside the API to see what)
Imageview.contentmode = Uiviewcontentmodescaleaspectfit;
6.3 steps to using the Plist file
1)//How to get plist file path! Plistname is the plist file name
NSBundle *bundle = [NSBundle mainbundle]; *path = [Bundle Pathforresource:@ "plistname" ofType:@ "plist" ];
2)//Get plist inside the array (can also be a dictionary, or string, depending on the type to see PLIST)
Plistarr = [Nsarray Arraywithcontentsoffile:path];
3)//use an array.
Differences in%.F and casts (int) in 7.NSlog
%.F is 4 5 into, 5.5->6;
(int) is the minus point,5.5->5;
So you need to be careful when you write.
8. Changing the bounds of the parent control will move the position of his child control, because the child control's frame is dominated by the parent control.
Father
UIView *superview = [[UIView alloc]initwithframe:cgrectmake]; = [Uicolor greencolor]; [Self.view Addsubview:superview]
Child
UIView *subview = [[UIView alloc]initwithframe:superview.frame]; = [Uicolor bluecolor]; [Superview Addsubview:subview];
= superview.bounds; = Cgpointmake ( <-) where the parent's X and Y are added, the opposite is the child's X, y minus (moving to the left) minus. superview.bounds = superbounds;
Early to do the first small project some problems summary + solution + explanation, hope novice less go a little detour