暑期留校之iOS学习笔记_ UiButton

8.16.

 

图片放大功能的实现,通过按钮阴影来实现首先通过一个按钮建立方法,在方法里面写入

1在创建一个大小和view一样大小的按钮,把这个按钮作为一个阴影

Uibutton *uicover=[[uibutton  alloc] init]

然后设置按钮大小

Uicover.frame = self.view.bounds(bounds与view大小相同);

设置按钮背景色

Uicover.backgroundcolor = [uicolor blackcolor];

设置按钮的透明度

Uicover.alpha=0.6;

把按钮添加到view中

[self.view  bringsubview:uicover];

2把图片设置到阴影上面

把self.view中得所有子控件 只把self.uiicon放到最上面

[self.view bringsubviewtofront:self.uiicon]

 

3通过动画的方式把图片放大

宽度 cgfloat iconW = self.view.frame.size.width;

高度 cgfloat iconH=iocnW;

cgfloat iconx=0;

cgfloat iconY=(self.view.frame.size.high-iconH)*0.5;

设置图片为新的frame

Self.uiicon.frame=cgrectmake(iconx, icony, iconW, iconH);

如果想让图片慢慢地放大 

通过一个函数

则需要重新

[uiview animatewithduration:20.0(20秒播放完)] animation:^{

Self.uiicon.frame=cgrectmake(iconx, icony, iconW, iconH);

}];

可以只需要一套图片 只准备iPhone5 预留出上下宽度 iPhone4  

图上的按钮 可以通过plist  准备两个尺寸

iPhone5 640* 1136

还要注意 选中 打开游戏的时候,全屏而不显示,状态栏  Failed to instantiate the default view controller for UIMainStoryboardFile

错误现象: XCODE 6.1 在使用storyboard时,报错:Failed to instantiate the default view controller for UIMainStoryboardFile 'MainStoryboard' - perhaps the designated entry point is not set?

原因分析:在StoryBoard中没有一个view controller设置了Initial Scene。

解决方案:在Storyboard中,选择一个view conroller作为story board的第一启动界面

 图片的 移动放大  有动画效果

改变默认 状态栏的字体颜色 Wi-Fi

-(UIstatusbarstyle)preferredstatusbarstyle

{

return uistastusbarstylelightcontent;

 

}

由深色变为白色

隐藏状态栏  

-(bool)prefersstatusbarhidden

{

return yes;

}

封装属性要封装俩个方法 

-(instancetype)initwithdict:(nsdictionary*)dict;

+(instancetype)questionwithdict:(nsdictionary*)dict;

  实现

-(instancetype)initwithdict:(nsdictionary*)dict

posted @ 2015-08-23 10:20  Joe.Smith  阅读(134)  评论(0编辑  收藏  举报