第一、UIButton的定义 
 
    UIButton *button=[[UIButton buttonWithType:(UIButtonType); 
能够定义的button类型有以下6种, 
 typedef enum { 
 UIButtonTypeCustom = 0, 自定义风格 
 
 UIButtonTypeRoundedRect, 圆角矩形  
 UIButtonTypeDetailDisclosure, 蓝色小箭头按钮,主要做详细说明用 
 UIButtonTypeInfoLight, 亮色感叹号 
 UIButtonTypeInfoDark, 暗色感叹号 
UIButtonTypeContactAdd, 十字加号按钮 
 
 } UIButtonType; 
第二、设置frame 
button1.frame = CGRectMake(20, 20, 280, 40); 
[button setFrame:CGRectMake(20,20,50,50)]; 
第三、button背景色 
 
button1.backgroundColor = [UIColor clearColor]; 
[button setBackgroundColor:[UIColor blueColor]]; 
 
第四、state状态 
 forState: 这个参数的作用是定义按钮的文字或图片在何种状态下才会显现 
enum { 
UIControlStateNormal = 0, 常规状态显现  
 UIControlStateHighlighted = 1 << 0, 高亮状态显现  
 UIControlStateDisabled = 1 << 1, 禁用的状态才会显现 
 UIControlStateSelected = 1 << 2, 选中状态  
 UIControlStateApplication = 0x00FF0000, 当应用程序标志时  
 UIControlStateReserved = 0xFF000000 为内部框架预留,可以不管他  
}; 
 
@property(nonatomic,getter=isEnabled)BOOL enabled;                                 // default is YES. if NO, ignores touch events and subclasses may draw differently 
@property(nonatomic,getter=isSelected)BOOL selected;                               // default is NO may be used by some subclasses or by application 
@property(nonatomic,getter=isHighlighted)BOOL highlighted;                           
第五 、设置button填充图片和背景图片 
 
    [buttonsetImage:[UIImageimageNamed:@"checkmarkControllerIcon"]forState:UIControlStateNormal]; 
    [buttonsetBackgroundImage:[UIImageimageNamed:@"checkmarkControllerIcon"]forState:UIControlStateNormal]; 
第六、设置button标题和标题颜色 
[button1 setTitle:@"点击" forState:UIControlStateNormal]; 
 
  [buttonsetTitleColor:[UIColorredColor]forState:UIControlStateNormal]; 
第七、设置按钮按下会发光 
 
    button.showsTouchWhenHighlighted=NO; 
 
第八、添加或删除事件处理 
[button1 addTarget:self action:@selector(butClick:) forControlEvents:UIControlEventTouchUpInside]; 
 
[btn removeTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside]; 
第九、 设置按钮内部图片间距和标题间距 
 UIEdgeInsets insets; // 设置按钮内部图片间距 
 insets.top = insets.bottom = insets.right = insets.left = 10; 
 bt.contentEdgeInsets = insets; 
 bt.titleEdgeInsets = insets; // 标题间距 
 
 
 
UILabel 
 
//创建UIlabel对象 
 
UILabel* label = [[UILabel alloc] initWithFrame:self.view.bounds]; 
 
//设置显示文本 
 
label.text = @"This is a UILabel Demo,"; 
 
//设置文本字体 
 
label.font = [UIFont fontWithName:@"Arial" size:35]; 
 
//设置文本颜色 
 
label.textColor = [UIColor yellowColor]; 
 
//设置文本水平显示位置 
 
label.textAlignment = UITextAlignmentCenter; 
 
//设置背景颜色 
 
label.backgroundColor = [UIColor blueColor]; 
 
//设置单词折行方式 
 
label.lineBreakMode = UILineBreakModeWordWrap; 
 
//设置label是否可以显示多行,0则显示多行 
 
label.numberOfLines = 0; 
 
//根据内容大小,动态设置UILabel的高度 
 
CGSize size = [label.text sizeWithFont:label.font constrainedToSize:self.view.bounds.size lineBreakMode:label.lineBreakMode]; 
 
CGRect rect = label.frame; 
 
rect.size.height = size.height; 
 
label.frame = rect;   
 
附上UILineBreakMode的各种情况,本人没有一一实验效果。 
 
typedef enum { 
   UILineBreakModeWordWrap = 0, 
   UILineBreakModeCharacterWrap, 
   UILineBreakModeClip, 
   UILineBreakModeHeadTruncation, 
   UILineBreakModeTailTruncation, 
   UILineBreakModeMiddleTruncation, 
} UILineBreakMode; 
 
 
   UILineBreakModeWordWrap = 0, 
   以单词为单位换行,以单位为单位截断。 
   UILineBreakModeCharacterWrap, 
   以字符为单位换行,以字符为单位截断。 
   UILineBreakModeClip, 
   以单词为单位换行。以字符为单位截断。 
   UILineBreakModeHeadTruncation, 
   以单词为单位换行。如果是单行,则开始部分有省略号。如果是多行,则中间有省略号,省略号后面有4个字符。 
   UILineBreakModeTailTruncation, 
   以单词为单位换行。无论是单行还是多行,都是末尾有省略号。 
   UILineBreakModeMiddleTruncation, 
   以单词为单位换行。无论是单行还是多行,都是中间有省略号,省略号后面只有2个字符。 
 
 
特殊效果实现: 
 
1. 竖排文字显示 
 
要实现这个效果,网友给出了四种方法: 
 
1.1 旋转UILabel,这种方法不可选,旋转之后每个字体的方向还是有问题。 
 
1.2 每个文字加一个换行符,这是最方便和简单的实现方式。 
 
label.text = @"请\n竖\n直\n方\n向\n排\n列"; 
label.numberOfLines = [label.text length]; 
 
1.3 创建新的canvas, 在UILabel上画出竖排文字。 
 
1.4 重写UILabel类,添加竖排文字显示功能。 
 
 
 
 
UIImageView 
 
 
1、创建一个UIImageView: 
 
创建一个UIImageView对象有五种方法: 
 
UIImageView *imageView1 = [[UIImageView alloc] init]; 
UIImageView *imageView2 = [[UIImageView alloc] initWithFrame:(CGRect)]; 
UIImageView *imageView3 = [[UIImageView alloc] initWithImage:(UIImage *)]; 
UIImageView *imageView4 = [[UIImageView alloc] initWithImage:(UIImage *) highlightedImage:(UIImage *)]; 
UIImageView *imageView5 = [[UIImageView alloc] initWithCoder:(NSCoder *)]; 
比较常用的是前边三个。至于第四个,当这个ImageView的highlighted属性是YES时,显示的就是参数highlightedImage,一般情况下显示的是第一个参数UIImage。 
 
2、frame与bounds属性: 
 
上述创建一个UIImageView的方法中,第二个方法是在创建时就设定位置和大小。 
 
当之后想改变位置时,可以重新设定frame属性: 
 
imageView.frame = CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat heigth); 
注意到UIImageView还有一个bounds属性 
 
imageView.bounds = CGRectMake(CGFloat x, CGFloat y, CGFloat width, CGFloat heigth); 
那么这个属性跟frame有什么区别呢? 
 
我的理解是,frame设置其位置和大小,而bounds只能设置其大小,其参数中的x、y不起作用即便是之前没有设定frame属性,控件最终的位置也不是bounds所设定的参数。bounds实现的是将UIImageView控件以原来的中心为中心进行缩放。例如有如下代码: 
 
imageView.frame = CGRectMake(0, 0, 320, 460); 
imageView.bounds = CGRectMake(100, 100, 160, 230); 
执行之后,这个imageView的位置和大小是(80, 115, 160, 230)。 
 
3、contentMode属性: 
 
这个属性是用来设置图片的显示方式,如居中、居右,是否缩放等,有以下几个常量可供设定: 
 
UIViewContentModeScaleToFill 
UIViewContentModeScaleAspectFit 
UIViewContentModeScaleAspectFill 
UIViewContentModeRedraw 
UIViewContentModeCenter 
UIViewContentModeTop 
UIViewContentModeBottom 
UIViewContentModeLeft 
UIViewContentModeRight 
UIViewContentModeTopLeft 
UIViewContentModeTopRight 
UIViewContentModeBottomLeft 
UIViewContentModeBottomRight 
注意以上几个常量,凡是没有带Scale的,当图片尺寸超过 ImageView尺寸时,只有部分显示在ImageView中。UIViewContentModeScaleToFill属性会导致图片变形。UIViewContentModeScaleAspectFit会保证图片比例不变,而且全部显示在ImageView中,这意味着ImageView会有部分空白。UIViewContentModeScaleAspectFill也会证图片比例不变,但是是填充整个ImageView的,可能只有部分图片显示出来。 
 
前三个效果如下图: 
 
       
 
   UIViewContentModeScaleToFill    UIViewContentModeScaleAspectFit  UIViewContentModeScaleAspectFill 
 
4、更改位置 
 
更改一个UIImageView的位置,可以 
 
4.1 直接修改其frame属性 
 
4.2 修改其center属性: 
 
imageView.center = CGPointMake(CGFloat x, CGFloat y); 
center属性指的就是这个ImageView的中间点。 
 
4.3 使用transform属性 
 
imageView.transform = CGAffineTransformMakeTranslation(CGFloat dx, CGFloat dy); 
其中dx与dy表示想要往x或者y方向移动多少,而不是移动到多少。 
 
5、旋转图像 
 
imageView.transform = CGAffineTransformMakeRotation(CGFloat angle); 
要注意它是按照顺时针方向旋转的,而且旋转中心是原始ImageView的中心,也就是center属性表示的位置。 
 
这个方法的参数angle的单位是弧度,而不是我们最常用的度数,所以可以写一个宏定义: 
 
#define degreesToRadians(x) (M_PI*(x)/180.0) 
用于将度数转化成弧度。下图是旋转45度的情况: 
    
 
6、缩放图像 
 
还是使用transform属性: 
 
imageView.transform = CGAffineTransformMakeScale(CGFloat scale_w, CGFloat scale_h); 
其中,CGFloat scale_w与CGFloat scale_h分别表示将原来的宽度和高度缩放到多少倍,下图是缩放到原来的0.6倍的示意图: 
 
    
 
7、播放一系列图片 
 
imageView.animationImages = imagesArray; 
// 设定所有的图片在多少秒内播放完毕 
imageView.animationDuration = [imagesArray count]; 
// 不重复播放多少遍,0表示无数遍 
imageView.animationRepeatCount = 0; 
// 开始播放 
[imageView startAnimating]; 
其中,imagesArray是一些列图片的数组。如下图: 
       
 
8、为图片添加单击事件: 
 
imageView.userInteractionEnabled = YES; 
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapImageView:)]; 
[imageView addGestureRecognizer:singleTap]; 
一定要先将userInteractionEnabled置为YES,这样才能响应单击事件。 
 
9、其他设置 
 
imageView.hidden = YES或者NO;    // 隐藏或者显示图片 
imageView.alpha = (CGFloat) al;    // 设置透明度 
imageView.highlightedImage = (UIImage *)hightlightedImage;     // 设置高亮时显示的图片 
imageView.image = (UIImage *)image;    // 设置正常显示的图片 
[imageView sizeToFit];    // 将图片尺寸调整为与内容图片相同 
 
 
 
UITextField 
 
1.创建 
01.UITextField* myTextField = [[UITextField alloc]initWithFrame:CGRectMake(50, 100, 200, 50)];   
 
2.设置委托 
01.myTextField.delegate = self;//委托类需要遵守UITextFieldDelegate协议   
 
3.设置属性UIControl属性对UITextField完全可以用,下面的都是UITextField扩展的属性 
01.myTextField.textAlignment = UITextAlignmentLeft;//默认就是左对齐,这个是UITextField扩展属性   
 
02.myTextField.borderStyle = UITextBorderStyleBezel;//默认是没有边框,如果使用了自定义的背景图片边框会被忽略掉   
 
03.myTextField.placeholder = @"请在此输入账号";//为空白文本字段绘制一个灰色字符串作为占位符   
 
04.myTextField.clearsOnBeginEditing = YES;//设置为YES当用点触文本字段时,字段内容会被清除   
 
05.myTextField.adjustsFontSizeToFitWidth = YES;//设置为YES时文本会自动缩小以适应文本窗口大小。默认是保持原来大小,而让长文本滚动   
 
06.//myTextField.background = [UIImage imageNamed:@"registBtn"];//可以接受UIImage对象,此项设置则边框失效。   
 
07.myTextField.clearButtonMode = UITextFieldViewModeUnlessEditing;//右边显示的'X'清楚按钮   
 
08.//myTextField.LeftView =   
 
09.//myTextField.leftViewMode =    
 
10.//myTextField.RightView =   
 
11.//myTextField.rightViewMode =     
 
 
4.下列方法在创建一个UITextField的子类时可以重写:borderRectForBounds指定矩形边界textRectForBounds 指定显示文本的边界placeholderRectForBounds指定站位文本的边界editingRectForBounds指定编辑中文本的边界clearButtonRectForBounds指定显示清除按钮的边界leftViewRectForBounds指定显示左附着视图的边界rightViewRectForBounds指定显示右附着视图的边界委托方法。 
======================================== 
01.- (CGRect)clearButtonForBounds:(CGRect)bounds{   
 
02.    return CGRectMake(bounds.origin.x +bounds.size.width-50,    
 
03.                      bounds.origin.y+bounds.size.height-20, 16, 16);   
 
04.}   
======================================== 
 
01.- (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{   
 
02.    //返回一个BOOL值,指定是否循序文本字段开始编辑   
 
03.    return YES;   
 
04.}   
 
======================================== 
01.- (void)textFieldDidBeginEditing:(UITextField *)textField{   
 
02.    //开始编辑时触发,文本字段将成为first responder   
 
03.}   
 
======================================== 
01.- (BOOL)textFieldShouldEndEditing:(UITextField *)textField{   
 
02.    //返回BOOL值,指定是否允许文本字段结束编辑,当编辑结束,文本字段会让出first responder   
 
03.    //要想在用户结束编辑时阻止文本字段消失,可以返回NO   
 
04.    //这对一些文本字段必须始终保持活跃状态的程序很有用,比如即时消息   
 
05.    return NO;   
 
06.}   
 
======================================== 
01.- (BOOL)textField:(UITextField*)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{   
 
02.    //当用户使用自动更正功能,把输入的文字修改为推荐的文字时,就会调用这个方法。   
 
03.    //这对于想要加入撤销选项的应用程序特别有用   
 
04.    //可以跟踪字段内所做的最后一次修改,也可以对所有编辑做日志记录,用作审计用途。      
 
05.    //要防止文字被改变可以返回NO   
 
06.    //这个方法的参数中有一个NSRange对象,指明了被改变文字的位置,建议修改的文本也在其中   
 
07.    return YES;   
 
08.}   
 
======================================== 
01.- (BOOL)textFieldShouldClear:(UITextField *)textField{   
 
02.    //返回一个BOOL值指明是否允许根据用户请求清除内容   
 
03.    //可以设置在特定条件下才允许清除内容   
 
04.    return YES;   
 
05.}   
 
 
======================================== 
01.-(BOOL)textFieldShouldReturn:(UITextField *)textField{   
 
02.    //返回一个BOOL值,指明是否允许在按下回车键时结束编辑   
 
03.    //如果允许要调用resignFirstResponder 方法,这回导致结束编辑,而键盘会被收起   
 
04.    [textField resignFirstResponder];//查一下resign这个单词的意思就明白这个方法了   
 
05.    return YES;   
 
06.}   
 
======================================== 
虚拟键盘挡住UITextField时的解决方法: 
RootViewController.h 中: 
#import <UIKit/UIKit.h> 
 
@interface RootViewController : UIViewController<UITextFieldDelegate> { 
 
UITextField *textField1; 
UITextField *textField2; 
 

@property (nonatomic,retain) UITextField *textField1; 
@property (nonatomic ,retain) UITextField *textField2; 
 
-(IBAction)backgroundTap:(id)sender; 
 
@end 
RootViewController.m 中: 
#import "RootViewController.h" 
 
@implementation RootViewController 
@synthesize textField1; 
@synthesize textField2; 
 
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. 
/* 
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 
if (self) { 
// Custom initialization. 

return self; 

*/ 
 
/* 
// Implement loadView to create a view hierarchy programmatically, without using a nib. 
- (void)loadView { 
 
UIView *back = [[UIView alloc] initWithFrame:[[UIScreen mainScreen]bounds]]; 
back.backgroundColor = [UIColor grayColor]; 
self.view = back; 
[back release]; 

*/ 
 
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 
- (void)viewDidLoad { 
[super viewDidLoad]; 
 
UIControl *_back = [[UIControl alloc] initWithFrame:self.view.frame]; 
_back.backgroundColor = [UIColor grayColor]; 
self.view = _back; 
[_back release]; 
[(UIControl *)self.view addTarget:self action:@selector(backgroundTap:) forControlEvents:UIControlEventTouchDown]; 
 
textField1 = [[UITextField alloc] initWithFrame:CGRectMake(20, 300, 200, 30)]; 
textField1.backgroundColor = [UIColor clearColor]; 
textField1.borderStyle = UITextBorderStyleRoundedRect; 
textField1.textColor = [UIColor redColor]; 
textField1.delegate = self; 
[self.view addSubview:textField1]; 
 
textField2 = [[UITextField alloc] initWithFrame:CGRectMake(20, 30, 200, 30)]; 
textField2.backgroundColor = [UIColor clearColor]; 
textField2.borderStyle = UITextBorderStyleRoundedRect; 
textField2.textColor = [UIColor redColor]; 
textField2.delegate = self; 
[self.view addSubview:textField2]; 

 
 
#pragma mark - 
#pragma mark 解决虚拟键盘挡住UITextField的方法 
- (void)keyboardWillShow:(NSNotification *)noti 
{  
//键盘输入的界面调整  
//键盘的高度 
float height = 216.0;  
CGRect frame = self.view.frame;  
frame.size = CGSizeMake(frame.size.width, frame.size.height - height);  
[UIView beginAnimations:@"Curl"context:nil];//动画开始  
[UIView setAnimationDuration:0.30];  
[UIView setAnimationDelegate:self];  
[self.view setFrame:frame];  
[UIView commitAnimations]; 

 
 
-(BOOL)textFieldShouldReturn:(UITextField *)textField 
{  
// When the user presses return, take focus away from the text field so that the keyboard is dismissed.  
NSTimeInterval animationDuration = 0.30f;  
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];  
[UIView setAnimationDuration:animationDuration];  
CGRect rect = CGRectMake(0.0f, 20.0f, self.view.frame.size.width, self.view.frame.size.height);  
self.view.frame = rect; 
[UIView commitAnimations]; 
[textField resignFirstResponder]; 
return YES;  

 
- (void)textFieldDidBeginEditing:(UITextField *)textField 
{  
CGRect frame = textField.frame; 
int offset = frame.origin.y + 32 - (self.view.frame.size.height - 216.0);//键盘高度216 
NSTimeInterval animationDuration = 0.30f;  
[UIView beginAnimations:@"ResizeForKeyBoard" context:nil];  
[UIView setAnimationDuration:animationDuration]; 
float width = self.view.frame.size.width;  
float height = self.view.frame.size.height;  
if(offset > 0) 

CGRect rect = CGRectMake(0.0f, -offset,width,height);  
self.view.frame = rect;  
}  
[UIView commitAnimations];  

 
#pragma mark - 
#pragma mark 触摸背景来关闭虚拟键盘 
-(IBAction)backgroundTap:(id)sender 

// When the user presses return, take focus away from the text field so that the keyboard is dismissed.  
NSTimeInterval animationDuration = 0.30f;  
[UIView beginAnimations:@"ResizeForKeyboard" context:nil];  
[UIView setAnimationDuration:animationDuration];  
CGRect rect = CGRectMake(0.0f, 20.0f, self.view.frame.size.width, self.view.frame.size.height);  
self.view.frame = rect; 
[UIView commitAnimations]; 
 
 
[textField1 resignFirstResponder]; 
[textField2 resignFirstResponder]; 

 
#pragma mark - 
 
 
/* 
// Override to allow orientations other than the default portrait orientation. 
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 
// Return YES for supported orientations. 
return (interfaceOrientation == UIInterfaceOrientationPortrait); 

*/ 
 
- (void)didReceiveMemoryWarning { 
// Releases the view if it doesn't have a superview. 
[super didReceiveMemoryWarning]; 
 
 
// Release any cached data, images, etc. that aren't in use. 

 
 
- (void)viewDidUnload { 
[super viewDidUnload]; 
// Release any retained subviews of the main view. 
// e.g. self.myOutlet = nil; 

 
 
- (void)dealloc { 
[textField1 release]; 
[textField2 release]; 
[super dealloc]; 

RootViewController.m 中的backgroundTap:方法,用来实现触摸背景来关闭虚拟键盘。 
这个方法用的时候首先把RootViewController上的view改成UIControl,然后通过UIControl的事件UIControlEventTouchDown来触发上面的方法backgroundTap: 。 
注意下面的代码: 
UIControl *_back = [[UIControl alloc] initWithFrame:self.view.frame]; 
_back.backgroundColor = [UIColor grayColor]; 
self.view = _back; 
[_back release]; 
[(UIControl *)self.view addTarget:self action:@selector(backgroundTap:) forControlEvents:UIControlEventTouchDown]; 
 
 
解决textField被键盘挡住的问题的方法有三个: 
- (void)keyboardWillShow:(NSNotification *)noti;//调整虚拟键盘与self.view之间的关系。 
-(BOOL)textFieldShouldReturn:(UITextField *)textField;//触摸键盘上的return键时关闭虚拟键盘 
- (void)textFieldDidBeginEditing:(UITextField *)textField;//当编辑文本的时候,如果虚拟键盘挡住了textField,整个view就会向上移动。移动范围是一个键盘的高度216。

转自:http://www.cocoachina.com/bbs/read.php?tid=195388&page=e&#a

UI小结的更多相关文章

  1. 使用MvvmCross框架实现Xamarin.Forms的汉堡菜单布局

    注:本文是英文写的,偷懒自动翻译过来了,原文地址:Implementing MasterDetail layout in Xamarin.Forms by MvvmCross 欢迎大家关注我的公众号: ...

  2. PCB NOSQL MongoDb MI流程指示数据存储结构

    一.MI流程指示结构 二.产品型号树结构(即盲埋孔板型号结构) 三.MI流程指示UI 小结:1.MI流程指示使用的表非常之多(30多张表),存储的数据分散到各个表中,而NOSQL 一个产品型号一条记录 ...

  3. [ PyQt入门教程 ] PyQt5环境搭建和配置

    PyQt入门系列教程主要目的是希望通过该系列课程学习,可以使用PyQt5工具快速实现简单的界面开发,包括界面设计.布局管理以及业务逻辑实现(信号与槽).简单说就是可以使用PyQt5工具快速画一个控件摆 ...

  4. iOS开发UI篇—UITableview控件使用小结

    iOS开发UI篇—UITableview控件使用小结 一.UITableview的使用步骤 UITableview的使用就只有简单的三个步骤: 1.告诉一共有多少组数据 方法:- (NSInteger ...

  5. C# 一些代码小结--UI操作

    C# 一些代码小结--UI操作 使用控件名调用控件 object obj = this.GetType().GetField("控件名", System.Reflection.Bi ...

  6. JQuery UI的拖拽功能实现方法小结

    JQuery UI提供的API极大简化了拖拽功能的开发.只需要分别在拖拽源(source)和目标(target)上调用draggable和droppable两个函数即可. 拖拽原理 首先要明确几个概念 ...

  7. iOS学习——UI相关小结

    1     StoryBoard: 在Info.plist中可以查看Main storyboard,即入口storyboard,默认为main.storyboard,可以修改为自己创建的storybo ...

  8. Winform非UI线程更新UI界面的各种方法小结

    我们知道只有UI线程才能更新UI界面,其他线程访问UI控件被认为是非法的.但是我们在进行异步操作时,经常需要将异步执行的进度报告给用户,让用户知道任务的进度,不至于让用户误认为程序“死掉了”,特别是对 ...

  9. 非UI线程更新UI界面的各种方法小结

    转载:https://www.cnblogs.com/xiashengwang/archive/2012/08/18/2645541.html 我们知道只有UI线程才能更新UI界面,其他线程访问UI控 ...

随机推荐

  1. ThinPHP5.0 目录结构

    官网文档  https://www.kancloud.cn/manual/thinkphp5/118008 project 应用部署目录├─application 应用目录(可设置)│ ├─commo ...

  2. Python数据结构和类型--解压序列赋值多个变量

    Python数据结构和类型 1.1 解压序列赋值给多个变量 现在有一个包含N个元素的元组或者是序列,怎样将它里面的值解压后同时赋值给N个变量? 解决思路:先通过简单的解压赋值给多个变量,前提是变量的数 ...

  3. 五. web开发基础

    一.HTML 二.CSS 三.JavaScript 四.web框架 1.web框架本质 众所周知,对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端 ...

  4. React框架搭建单页面应用package.json基本包和依赖包

    { //依赖包 "devDependencies": { //babel "babel-core": "6.24.1", "bab ...

  5. Linux 中 MySQL 授权远程连接

    说明:当别的机子(IP )通过客户端的方式在没有授权的情况下是无法连接 MySQL 数据库的,如果需要远程连接 Linux 系统上的 MySQL 时,必须为其 IP 和具体用户进行授权.一般 root ...

  6. H5新人福音~零配置搭建现代化的前端工程

    X-BUILD一套基于Webpack(v4.21.0)快速搭建H5场景开发环境的脚手架,只需要几分钟的时间就可以运行起来.X-BUILD是针对H5开发的一套自动化构建工具,致力于提升开发效率,减小开发 ...

  7. python--内置函数, 匿名函数

    一 . 内置函数 什么是内置函数? 就是python给你提供的. 拿来直接⽤的函数, 比如print., input等等. 字符串类型代码的执⾏ eval() 执⾏字符串类型的代码. 并返回最终结果( ...

  8. windows中Python多版本与jupyter notebook中使用虚拟环境

    本人电脑是windows系统,装了Python3.7版本,但目前tensorflow支持最新的python版本为3.6,遂想再安装Python3.6以跑tensorflow. 因为看极客时间的专栏提到 ...

  9. raywenderlich.com Objective-C编码规范

    原文链接 : The official raywenderlich.com Objective-C style guide 原文作者 : raywenderlich.com Team 译文出自 : r ...

  10. C/C++编程之内存管理

    内存分配方式 内存分配方式一共有三种: (1)从静态存储区域分配: 内存在程序编译的时候就已经分配好,这块内存在程序的整个运行期间都存在,例如,全局变量,静态变量. (2)在栈上创建: 在执行函数时, ...