1.做横竖屏适配的时,需要判断当前状态是横屏还是竖屏,有两种方法: 第1种:[UIScreen mainScreen].bounds.size.width == 768 优点:把这个抽成宏之后,随时可以判断横竖屏,#define Lanscape ([UIScreen mainScreen]...
分类:
移动开发 时间:
2015-03-06 20:44:45
阅读次数:
190
#pragma mark - 设置自定义视图- (void)loadView{ self.rootView = [[[RootView alloc] initWithFrame:[UIScreen mainScreen].bounds] autorelease]; _rootView.backg.....
分类:
其他好文 时间:
2015-03-05 12:28:11
阅读次数:
158
先看看我们的效果
这种图片切换经常出现商城或者论坛的首页用于展示
分析
这里我用了UIScrollView和pageControll实现了一种平铺导航,涉及到两种操作:
1 点击pageControl换页
2 换页转换pageControll
实现
#import "ViewController.h"
#define WEIGHT [UIScreen ...
分类:
移动开发 时间:
2015-02-27 11:59:17
阅读次数:
147
直接上代码 UIView *myView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; myView.backgroundColor = [UIColor redColor]; [self.view a...
分类:
移动开发 时间:
2015-02-22 10:58:28
阅读次数:
139
我在使用Xcode6时手动创建ViewController时也遇到了这样的问题,后来发现是因为项目设置中的LaunchImagesSource没有设置好的原因。因为把Xcode6自动生成的LaunchScreenController.xib删除了,项目设置中的LaunchImagesSource选项变成了UseAssetCatalog,这时又没有指定正确的Im..
分类:
其他好文 时间:
2015-02-15 23:12:50
阅读次数:
395
CGSize labelSize=[self.myDetailLabel.text
boundingRectWithSize:CGSizeMake([UIScreen
mainScreen].bounds.size.width-20,
0) options:NSStringDrawingUsesLineFragmentOrigin
attributes:@{NSFontAttributeN...
分类:
移动开发 时间:
2015-02-03 23:09:50
阅读次数:
471
在iOS的开发过程中我们经常需要根据label上文字的内容动态显示,当label上的内容超过一行是我们需要实现换行,让文字能够分多行进行显示。下面通过一个例子进行具体实现:
CGFloat UIScreen mainScreen]bounds].size.width;
self.textLabel.frame = CGRectMake(105, 20, view_width-10-10...
分类:
移动开发 时间:
2015-01-28 11:12:13
阅读次数:
787
- (void)jiazaitxt{
self.myWebview = [[UIWebView
alloc]initWithFrame:CGRectMake(0,
0, [UIScreen
mainScreen].bounds.size.width, [UIScreen
mainScreen].bounds.size.height+60)];
// myWebVi...
分类:
移动开发 时间:
2015-01-27 11:06:51
阅读次数:
267
- (IBAction)Slider:(id)sender { [[UIScreen mainScreen] setBrightness: mSlider.value];}- (IBAction)Stepper:(id)sender { [[UIScreen mainScreen] setBrig....
分类:
其他好文 时间:
2015-01-23 21:21:36
阅读次数:
206