Magic Studio

专心做有逼格的APP!

随笔分类 -  iOS

iOS开发--使用lipo命令制作模拟器与真机通用静态库
摘要:通常在项目中使用静态库的时候都会有两个版本,一个用于模拟器,一个用于真机,因为Mac和iPhone的CPU不同,才造成了这种情况。为了模拟器与真机之间切换调试的方便,制作通用版本非常有必要。现在有两个版本的静态库libSQLite_i386.a(模拟器)与libSQLite_arm.a(真机)。1、打开终端,进入到这两个文件所在的目录;2、执行:lipo -create libSQLite_i386.a libSQLite_arm.a -output libSQLite.a,这时文件就会多出libSQLite.a,这个文件即为通用静态库。我们可以lipo -infolibSQLite.a命令, 阅读全文

posted @ 2013-11-24 14:13 Mr 布鲁斯 阅读(394) 评论(0) 推荐(0)

Assigning retained object to weak property object will be released after assignment
摘要:在ARC中,如果添加了weak的属性。初始化了相关的object然后给这个属性赋值的时候就会看到Xcode给出这个提示。这个时候可以这么处理:在别的地方已经retain这个object的引用。@property (nonatomic, weak) KGModalContainerView *containerView;...-(void)viewDidLoad { [super viewDidLoad]; KGModalContainerView *myContainerView = [[KGModalContainerView alloc] initWithFrame:conta... 阅读全文

posted @ 2013-11-21 23:49 Mr 布鲁斯 阅读(2313) 评论(0) 推荐(0)

iOS 7 - Auto Layout on iOS Versions prior to 6.0
摘要:遇到这个问题的时候,只需要两步就可以搞定。1. 点击你的xib文件,在界面处理右边栏里选择第一个tab,在里面uncheck User Autolayout这一项2. 在View as对应的下拉列表里选择iOS6 or earlier。这样在编译一次就可以保证没有错误了。第一项完成之后其实就不会出什么错了,但是第二项很重要,否则在console里会出现一对的Context不对的CoreGraphic警告。 阅读全文

posted @ 2013-11-21 19:00 Mr 布鲁斯 阅读(459) 评论(0) 推荐(0)

暂停、恢复CALayer 动画
摘要:CALayer都是实现了CAMediaTiming协议(或者叫做接口)。所以layer的动画有一个很有意思的属性speed。如果一个layer的动画速度变成0.0的时候,很显然这个动画就不再动了。设置layer的speed为0时,layer的动画暂停。speed属性设置为任意大于0的值时,动画回复。要暂停一个动画时:-(void)pauseLayer:(CALayer*)layer { CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil]; layer.speed = 0.0... 阅读全文

posted @ 2013-11-11 23:21 Mr 布鲁斯 阅读(898) 评论(0) 推荐(0)

CALayer, CoreGraphics与CABasicAnimation介绍
摘要:今天我们来看一下CALayer、CoreGraphics和CABasicAnimation。这些东西在处理界面绘制、动画效果上非常有用。本篇博文就讲介绍CALayer的基本概念,使用CoreGraphics自定义绘制,以及基于CABasicAnimation的动画。以下内容都假定您有一定的Object-C基础,也熟悉UIView等相关的操作。如果不熟的话,您还要自行查阅资料。这里就不多讲了。要使用CALayer,首先要添加QuartzCore框架。然后在你的Controller里添加包含该框架的头文件#import 在Controller的实现中添加viewDidAppear:方法。每个vie 阅读全文

posted @ 2013-11-07 15:13 Mr 布鲁斯 阅读(1355) 评论(1) 推荐(1)

移动开发iOS&Android对比学习--异步处理
摘要:在移动开发里很多时候需要用到异步处理。Android的主线程如果等待超过一定时间的时候直接出现ANR(对不熟悉Android的朋友这里需要解释一下什么叫ANR。ANR就是Application Not Responding,应用无响应的意思。系统在应用一段时间无响应的时候会弹出这个对话框。用户可以选择继续等待或者强制关闭)。这些还是次要的,最主要的还是心急的用户。让用户长时间等待是得罪他们的最好办法!Android有一个很简单的办法实现异步处理:AnsyncTask。使用的时候你需要继承一个基类public abstract class AsyncTask对java不熟的同学这里需要说明,尖括 阅读全文

posted @ 2013-11-06 18:59 Mr 布鲁斯 阅读(1039) 评论(1) 推荐(1)

iOS play video
摘要:iOS: How to use MPMoviePlayerControllerup vote6down votefavorite3I've created a blank project (iOS) and put this in my viewDidLoad:NSString*moviePath =[[NSBundle mainBundle] pathForResource:@"Movie" ofType:@"m4v"];MPMoviePlayerViewController*playerController =[[MPMoviePlayerV 阅读全文

posted @ 2013-10-05 22:46 Mr 布鲁斯 阅读(936) 评论(0) 推荐(0)

ios7适配--uitableviewcell选中效果
摘要:ios7 UITableViewCell selectionStyle won't go back to blueup vote6down votefavorite2Xcode 5.0, iOS 7 and updating an existing app.UITableViewselected row is now gray, not blue.From what I've read they changed the defaultselectionStyleto gray. But "Blue" is still an option in IB andU 阅读全文

posted @ 2013-09-27 10:14 Mr 布鲁斯 阅读(655) 评论(0) 推荐(0)

ios7 设置status bar风格
摘要:How to change status bar style during launch on iOS 7up vote4down votefavoriteWhen I launch my app, it shows the launch image and a black status bar. How can I change it so the status bar is light during launch? I have set the status bar appearance to light in my AppDelegate didFinishLoading method, 阅读全文

posted @ 2013-09-26 16:18 Mr 布鲁斯 阅读(316) 评论(0) 推荐(0)

ios7适配--隐藏status bar
摘要://viewDidloadif ([self respondsToSelector:@selector(setNeedsStatusBarAppearanceUpdate)]) {// iOS 7[self prefersStatusBarHidden];[self performSelector:@selector(setNeedsStatusBarAppearanceUpdate)];} else {// iOS 6[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnima 阅读全文

posted @ 2013-09-25 21:26 Mr 布鲁斯 阅读(284) 评论(0) 推荐(0)

ios7适配--navgationbar遮住下面view的处理
摘要:3down votefavoriteHave you guys stumbled up on this issue ?Basically in iOS 7 Navigation Controller is rendered over the sub-view I navigated to.In iOS 6 view I navigate to is enclosed between navigation bar and footer. In iOS 7 it looks like sub-view is rendered full-screen, under navigation bar an 阅读全文

posted @ 2013-09-25 14:27 Mr 布鲁斯 阅读(1437) 评论(0) 推荐(0)

UIView的alpha、hidden和opaque属性之间的关系和区别[转]
摘要:UIView的alpha、hidden和opaque属性之间的关系和区别作者:wangzz原文地址:http://blog.csdn.net/wzzvictory/article/details/10076323转载请注明出处UIView的这几个属性让我困惑了好一阵子,通过翻看官方文档和stackoverflow等网上资源,对它们有了一定理解,现分享出来。如理解有误,还请大家指出。一、alpha液晶显示器是由一个个的像素点组成的,每个像素点都可以显示一个由RGBA颜色空间组成的一种色值。其中的A就表示透明度alpha,UIView中alpha是一个浮点值,取值范围0~1.0,表示从完全透明到完 阅读全文

posted @ 2013-09-24 10:29 Mr 布鲁斯 阅读(366) 评论(0) 推荐(0)

ios屏幕旋转
摘要:屏幕旋转// ios 5、6都有这个方法- (BOOL)shouldAutorotate{ returnYES;}//ios6有效- (NSUInteger)supportedInterfaceOrientations{ returnUIInterfaceOrientationMaskLandscape;}//ios5有效- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{ return ((toInterfaceOrientation==UIInter... 阅读全文

posted @ 2013-09-20 11:29 Mr 布鲁斯 阅读(235) 评论(0) 推荐(0)

Redesign Your App for iOS 7 之 页面布局【转】
摘要:前言iOS7是目前iOS史上最颠覆的一次改版。它的出现令人兴奋,因为它将会带我们进入一个全新的时代;它的到来也让我们忧心,因为它颠覆了一切,包括我们过去做过的很多努力。但是,相信大家乐意为这个全新时代做更多的努力,因为,它值得期待。最近打算写一系列针对iOS7新特性的文章,今天就从最基本和简单的页面布局开始吧。从头说起当我看见iOS7那个半透明设计的navigationBar,已经有种不详的预感。因为要透过navigationBar看到底下滚动的内容,那么底下的内容必须从顶部开始布局,并且需要设定相应的内边距以让初始内容显示在合适的位置上。要对应用适配这种凶残设计,其工作量绝比适配iPhone 阅读全文

posted @ 2013-09-16 00:12 Mr 布鲁斯 阅读(566) 评论(0) 推荐(0)

How to safely shut down a loading UIWebView in viewWillDisappear?
摘要:up vote24down votefavorite24I have a view containing a UIWebView which is loading a google map (so lots of javascript etc). The problem I have is that if the user hits the 'back' button on the nav bar before the web view has finished loading, it is not clear to me how to tidily tell the web 阅读全文

posted @ 2013-09-11 15:38 Mr 布鲁斯 阅读(1083) 评论(0) 推荐(0)

处理iOS设备的屏幕旋转
摘要:某些情况下,不强制的给用户唯一的屏幕角度给用户。这样用户可以旋转手机得到不同的视觉体验。最简单的就是safari,横看竖看都可以。这时需要捕捉用户的屏幕旋转事件并处理。很简单,才两步。比把大象装冰箱都简单。下面是代码: 1 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 2 { 3 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 4 if (self) { 5 [[... 阅读全文

posted @ 2013-09-07 22:28 Mr 布鲁斯 阅读(516) 评论(0) 推荐(0)

Instruments Tutorial for iOS: How To Debug Memory Leaks【转】
摘要:If you're new here, you may want to subscribe to myRSS feedor follow me onTwitter. Thanks for visiting!Call the plumber, it's-a-leaking!Update 4/12/13:These days, you should probably be using Apple’s new Automatic Reference Counting (ARC) technology instead of doing manual memory management. 阅读全文

posted @ 2013-09-06 10:36 Mr 布鲁斯 阅读(687) 评论(0) 推荐(0)

自定义UINavigationBar的背景【转】
摘要:from:http://cocoa.venj.me/blog/custom-navbar-background/为了让我们的应用程序更加美观,我们往往希望对iPhone自带的控件进行一点自定义。比如,本文即将要讲述的,给UINavigationBar加一个背景。最简单的一个自定义方法就是修改一下背景色。方法非常简单,那就是使用它的tintColor属性:1self.navigationController.navigationBar.tintColor = [UIColor redColor];这样就轻松地为UINavigationBar加上了红色的背景色–当然你可以使用任何颜色。下面是模拟器 阅读全文

posted @ 2013-08-23 16:46 Mr 布鲁斯 阅读(342) 评论(0) 推荐(0)

iOS编程——Objective-C KVO/KVC机制[转]
摘要:这两天在看和这个相关的的内容,全部推翻重写一个版本,这是公司内做技术分享的文档总结,对结构、条理做了更清晰的调整。先找了段代码,理解下,网上看到最多的一段的关于KVC的代码先上代码1.1.Person类2.@implementationPerson3.@synthesizename,age;//属性name将被监视4.-(void)changeName5.{6.name=@"changeNamedirectly";7.}8.@end9.10.11.2.PersonMonitor类监视了name属性12.@implementationPersonMonitor13.14.-( 阅读全文

posted @ 2013-08-21 16:02 Mr 布鲁斯 阅读(342) 评论(0) 推荐(0)

ios PNG Crush error (PNG图片错误)
摘要:我是这么解决的:I had the same problem. How to fix : Open up image with Preview -> File > Export > Format change to PNG and you are done其他被采纳的方法:12 Answersactiveoldestvotesup vote41down voteacceptedDid you check whether the fileUsers/kavapanga/Desktop/iPAD/ALN II 3 latest 2/trunk/Resourses/images/C 阅读全文

posted @ 2013-08-21 15:59 Mr 布鲁斯 阅读(1054) 评论(0) 推荐(0)

导航