1、所有控件都继承自UIView,UIView的常见属性如下:@property(nonatomic,readonly) UIView *superview;获得自己的父控件对象@property(nonatomic,readonly,copy) NSArray *subviews;获得自己的所有子控件对象@property(nonatomic) NSInteger tag;控件的ID\标识,父控件可以通过tag来找到对应的子控件@property(nonatomic) CGAffineTransform transform;控件的形变属性(可以设置旋转角度、比例缩放、平移等属性)@property(nonato...
@当我们在一个UIViewController中同时创建2个tableView的时候,如果把它们的frame中的Y坐标设置为一样,你可能会发现它们的位置并没有达到你想要的结果.比如第一tableView个frame(0,0,320,568),另一个也frame(0,0,320,568),结果会发现第二个tableView的第一行数据被导航栏遮挡了,以至于我们不得已把第二个frame改成(0,64,320,568-64),虽然效果变成了我们想要的,但是却不知道这是什么原因.......其实这一切都是automaticallyAdjustsSc...
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; //能够定义的button类型有以下6种 /*typedef enum{ UIButtonTypeCustom = 0; 自定义风格 UIButtonTypeRoundedRect, 圆角矩形 UIButtonTypeDetailDisclosure 蓝色小箭头按钮,主要做详细说明用 UIButtonTypeInfoLight // 亮色感叹号 UIButtonTypeInfoDark 暗色感叹号 UIButtonTypeContactAdd 十字加号按钮 }...
假设需要解决的问题:写代码时遇到一种情况,就是需要判断iOS版本,可能低版本和高版本需要增减一些代码,此时,如何判断iOS版本?(1)第一步,当然度娘,输入“iOS 判断系统版本”。(2)第二步:打开前几个你会发现,其实都有[UIDevicecurrentDevice]的身影,就算是新手,估计也知道UIDevice应该是个大BOSS,我们在自己的xcode里面输入这个。(3)第三步:我们按住CMD时鼠标经过UIDevice时时可以点击的,所以点击吧少年,然后就...
//// WJRuntime.m
// RuntimeSkip
//// Created by tqh on 15/9/8.
// Copyright (c) 2015年 tqh. All rights reserved.
//
#import"WJRuntime.h"#import <objc/runtime.h>
@implementation WJRuntime//runtime跳转+ (void)runtimePush:(NSString *)vcName dic:(NSDictionary *)dic nav:(UINavigationController *)nav {//类名(对象名) NSString *class = vcName;constchar *className = [class cStringUsingEncoding:NSASC...
当你定义了一系列的变量时,需要写很多的getter和setter方法,而且它们的形式都是差不多的,,所以Xcode提供了@property
和@synthesize属性,@property用在 .h 头文件中用作声明,@synthesize用在.m 文件中用于实现。如下,新建一个基于“Command Line Tool”的项目,名为“property”,再新建一个Student类,传统的写法是:Student.h[cpp]view plaincopy// // Student.h // property // // Created by Rio.King on 13-8-2...
iOS开发UI篇—transframe属性(形变)1. transform属性在OC中,通过transform属性可以修改对象的平移、缩放比例和旋转角度常用的创建transform结构体方法分两大类(1) 创建“基于控件初始位置”的形变CGAffineTransformMakeTranslation(平移)CGAffineTransformMakeScale(缩放)CGAffineTransformMakeRotation(旋转) (2) 创建“基于transform参数”的形变CGAffineTransformTranslateCGAffineTransformScaleCGAffineTransfor...
(1)UITextView和UITextField的区别可以(简单)理解为,前者是一块区域可以写很多东西有换行滚动条神马的,后者只有一行文本,类似于html里面的textarea和text。(2)在本例中,我们利用一个UITextField和一个UIButton不断把UITextField里面的内容加到UITextView的最后一行。这里面用到给按钮增加 一个事件,并在事件里面把UITextField.text加到UITextView.text的后面。(3)在本例中为了用户体验,可以设置每次增减内容后,光标...
-(id)initWithDic:(NSDictionary *)dic
{if (self = [super init]) {[self setValuesForKeysWithDictionary:dic];}return self;
}-(void)setValue:(id)value forUndefinedKey:(NSString *)key{if ([key isEqualToString:@"new_app_picpath"]) {_mynew_app_picpath = value;}
}原文:http://www.cnblogs.com/WJJ-Dream/p/5809191.html
文本属性Attributes1.NSKernAttributeName: @10 调整字句 kerning 字句调整2.NSFontAttributeName : [UIFont systemFontOfSize:_fontSize] 设置字体3.NSForegroundColorAttributeName :[UIColor redColor] 设置文字颜色4.NSParagraphStyleAttributeName : paragraph 设置段落样式5.NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];paragraph.alignment = NSTextAlignmentCenter;6.NSBackgroundColor...
vue-resource更换为axiosnpm install axios/*main.js*/import axios from ‘axios‘Vue.prototype.$ajax = axios/*components*/import axios from ‘axios‘export default { created () { axios.get(‘./static/data.json‘).then(res => { }) }}获取DOM<div class="tab" ref="domList"></div><script>created () { this.$nextTick(() => { console.log(this.$refs.domList) })}</script>原文:http://www.cnb...
在次之前,补充个内容。UIDevice是无法获得具体的设备型号的。要获得设备型号,比如(iphone 4s, iphone5)这样的,要通过这样的办法。1.引入头文件。#include <sys/types.h>#include <sys/sysctl.h>2.获取型号 //手机型号。
size_t size;
sysctlbyname("hw.machine", NULL, &size, NULL, 0);
char *machine = (char*)malloc(size);
sysctlbyname("hw.machine", machin...
contentSize 属于CGSize类型,CGSizeMake(width,height),宽度决定了UIScrollView滚动的水平距离,height决定了UIScrollView滚动的纵向距离,contenSize属性如果不设置值那么不能滚动视图 //设置一个UIScrollView UIScrollView *sv = [[UIScrollView alloc] initWithFrame:self.view.bounds]; sv.backgroundColor = [UIColor cyanColor]; [self.view addSubview:sv]; //添加一个视图 UIImage *image = [UIIma...
1.NSKernAttributeName:@10 调整字句 kerning 字句调整 2.NSFontAttributeName :[UIFont systemFontOfSize:_fontSize] 设置字体 3.NSForegroundColorAttributeName:[UIColor redColor] 设置文字颜色 4.NSParagraphStyleAttributeName :paragraph 设置段落样式NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];paragraph.alignment = NSTextAlignmentCenter; 6.NSBackgroundColorAttributeName:[UICol...
直接上代码,里面有各种属性的用法注释,至于每个属性有多个可以设置的值,每个值的效果如何,可以通过查看这个函数参数的枚举量,并逐一测试。 1//制作登陆界面 2#import"ViewController.h" 3 4@interface ViewController (){5 6//定义全局变量(控件) 7 UITextField *username;8 UITextField *password;9 UIButton *resignbutton;10 UIButton *loginbutton;11int i;12 NSMutableArray *imagearray;1...