iOS开发--1【Objective-C】

1、IBAction vs. IBOutlet

用于storyboard或xib的连接。
Not used by the compiler, they are used by Interface Builder. -- use these keywords to parse out the outlets or actions.

Interface Builder: can only see methods that are prefaced with IBAction and see variables and properties that are prefaced with IBOutlet.

these variables and methods aren't deal with entirely in code, we need to delve into the relevant nib file to see how things are hooked up and used.

(weak, nonatomic)

2、View Controller


 - job: to manage a single screen from your app. each         
        screen in your app gets its own view 
        controller.

 - .h: tells the computer what the view controller does
 - .m: tells the computer how it does those things

3、iOS9中关于alert的改变

这里写图片描述

4、Portrait vs. Landscape


 - Device Orientation: if only landscape, go to Generate to uncheck portrait.

iPhone4:320*480
iPhone5:320*568
iPhone6:375*667

5、Slider

  • 修改slider默认样式:

这里写图片描述

  • slider.value【UISlider】
- (IBAction)sliderMoved:(UISlider *)slider{
    NSLog(@"%f", slider.value);
}

slider的值是float形式

6、取整【%d】

int(): 取小数点前的整数
round(): 四舍五入取最近的整数 

7、Local variables vs. instance variables

local variables: exist very breifly
                 eg: message
instance variables: lives on forever, 前面有下划线
                    eg: _message

8、Properties vs. instance variables

properties: "backed" by an instance variable
preperty-->store its value somewhere<--an instance variable is a good place for that

properties are always accessed using [self]:

 - this uses the property:
    self.slider.value = 50;
    【property can be accessed by other objects that are outside of your view controller.】

 - this uses the backing instance variable directly:
    _slider.value = 50;
    【are supposed to be used only by the insides of an object, other objects aren't intended to see them or use them.】

9、Generate the random number

arc4random_uniform(N):生成N-1的随机数
一般:arc4random_uniform(N) + 1: 生成1-100随机数

10、iOS9 Storyboard Segue


 - show: 把新的内容push到当前view controller stack顶部
 - show detail: 把新的内容取代view controller stack顶部
 - present modally: 模态展示内容
 - present as popover: 在当前的view上出现一个小窗口来展示内容(如:选中文字出现 复制/翻译 的按钮)
  • 返回上一页:

这里写图片描述

11、webView,加载htmlFile

这里写图片描述

12、CATransition【Core Animation】

这里写图片描述

13、自动布局

  • 屏幕适配:pin–>constraints
  • 永远居中: Align
  • 多元素自动布局: 选中一部分elements–>Editor–>View
    之后把view的background color变为clear
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值