Fork me on GitHub
上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 125 下一页

2012年3月7日

摘要: 在写代码的时候很容易被一些那些我们看似简单的问题难住,也严重影响了我们工作的进度,所以今天把一些在iOS中常用关于类型的转换和常用的用法总结下。字符的表示含义:%c 一个单一的字符%d 一个十进制整数%i 一个整数 //原来i%是这个区别啊%e, %f, %g 一个浮点数%o 一个八进制数%s 一个字符串%x 一个十六进制数%p 一个指针 //也挺特别的%n 一个等于读取字符数量的整数 //特别的东东%u 一个无符号整数%[] 一个字符集 //没见过%% 一个精度符号//一、NSString/*—————-创建字符串的方法—————-*/1、创建常量字符串。NSString *astring 阅读全文
posted @ 2012-03-07 08:19 pengyingh 阅读(5153) 评论(0) 推荐(1)
摘要: 第一种方法//Add text to UIImage -(UIImage *)addText:(UIImage *)img text:(NSString *)text1{ int w = img.size.width; int h = img.size.height; //lon = h - lon; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate(NULL,... 阅读全文
posted @ 2012-03-07 08:10 pengyingh 阅读(415) 评论(0) 推荐(0)
摘要: 现在小弟遇见了一个很让人头疼的问题.我在初始化页面的时候把页面显示位置改成interfaceOrientation==UInterfaceOrientationlandscapeRight坐标系是按照右横着放来的.我根据坐标放控件的位置这都没有问题.我在页面设置了点击了事件,我用NSLog(location.x,location.y)获得的坐标却还是按照竖着放得到的坐标.比如我现在需要控件的坐标是(248,700)宽100高50 但是我获得点击这个控件的坐标却是(68,248).我就按照这个坐标来写点击事件了.在虚拟机上运行的没问题.但是放到真机上.点击坐标却是按照(248,700)来的.原来 阅读全文
posted @ 2012-03-07 07:54 pengyingh 阅读(146) 评论(0) 推荐(0)
摘要: -[UIView convertPoint:toView:]第一个参数传(0, 0)第二个参数传[[UIApplication sharedApplication] keyWindow]不过要保证你的window的frame为(0, 0, ***, ***) 阅读全文
posted @ 2012-03-07 07:46 pengyingh 阅读(1707) 评论(0) 推荐(0)

2012年3月6日

摘要: 类似于一个网络状况的探针。 [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(reachabilityChanged:) name: kReachabilityChangedNotification object: nil]; hostReach = [[Reachability reachabilityWithHostName: @"hubj.cnblogs.com"] retain]; [hostReach startNotifier]; wifiReach=[[Rea 阅读全文
posted @ 2012-03-06 16:56 pengyingh 阅读(13443) 评论(0) 推荐(0)
摘要: 感谢大家关注,自己找到问题的原因了。虚拟器不支持按下"Home"后继续播放,真机Ok!在按下设备的 “home”键后,程序在后台运行,希望继续播放乐曲。各位老大帮看看我哪里做错了?或缺少什么代码?谢谢。我已经进行了如下设置:在程序启动时- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {// Override point for customization after application launch./ 阅读全文
posted @ 2012-03-06 16:41 pengyingh 阅读(460) 评论(0) 推荐(0)
摘要: CGRect frame = CGRectMake (origin.x, origin.y, size.width, size.height);矩形NSStringFromCGRect(someCG) 把CGRect结构转变为格式化字符串;CGRectFromString(aString) 由字符串恢复出矩形;CGRectInset(aRect) 创建较小或较大的矩形(中心点相同),+较小 -较大CGRectIntersectsRect(rect1, rect2) 判断两矩形是否交叉,是否重叠CGRectZero 高度和宽度为零的/位于(0,0)的矩形常量 阅读全文
posted @ 2012-03-06 16:23 pengyingh 阅读(146) 评论(0) 推荐(0)
摘要: 加载到NSArray/NSMutableArray里的对象,不需要负责releaseThe objects added to NSArray/NSMutableArray need not to be released.copy是创建,retain是引用the copy operation is create a new one,but the retain operation is just a reference.you触摸的不是UIEvent,而是NSSet的UIViewwhat you touch on screen is not UIEvent but UIView屏幕上看到的,都是 阅读全文
posted @ 2012-03-06 16:03 pengyingh 阅读(3433) 评论(0) 推荐(0)
摘要: 做过几次有关UIView坐标变换的,但是经常不能得到自己想要的效果,今天就把它仔细研究了下。记下来等以后忘记的时候再复习重写shouldAutorateToInterfaceOrientation:,限制某个方向会改变原点的位置,原点会一直保持在左上角,但已经不是原来的左上角了setStatusBarOrientation.改变状态栏的方向。它不会改变原点的位置,但会改变键盘的方向旋转前self.myview的frame ={0,0,320,50}CGAffineTransform at =CGAffineTransformMakeRotation(M_PI/2);[self.myviewse 阅读全文
posted @ 2012-03-06 16:00 pengyingh 阅读(9570) 评论(0) 推荐(0)
摘要: 什么对象是dipatching的UIViewController旋转的方法调用,即负责:- shouldAutorotateToInterfaceOrientation:- willRotateToInterfaceOrientation:时间:- willAnimateFirstHalfOfRotationToInterfaceOrientation:时间:- willAnimateSecondHalfOfRotationFromInterfaceOrientation:时间:- didRotateFromInterfaceOrientation:我猜想,UIApplication(但也许是 阅读全文
posted @ 2012-03-06 15:54 pengyingh 阅读(1937) 评论(0) 推荐(0)
上一页 1 ··· 69 70 71 72 73 74 75 76 77 ··· 125 下一页

导航