摘要: UIResponder* nextResponder = [view nextResponder]; if ([nextResponder isKindOfClass:[UIViewController class]]) { return (UIViewController*)nextResponder; view是当前view,可以获取起controller; 阅读全文
posted @ 2011-11-28 17:07 痴人指路 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2011-11-21 17:49 痴人指路 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 1.创建并初始化创建UITextView的文件,并在.h文件中写入如下代码:#import <UIKit/UIKit.h>@interface TextViewController : UIViewController <UITextViewDelegate>{ UITextView *textView;}@property (nonatomic, retain) UITextView *textView;@end在.m文件中初始化这个textview,写入代码如下:self.textView = [[[UITextView alloc] initWithFrame:s 阅读全文
posted @ 2011-11-20 11:27 痴人指路 阅读(677) 评论(0) 推荐(0) 编辑
摘要: http://www.devdiv.com/thread-67521-1-1.html最近看这个比较多人用到,以前有使用过,现在,粘过来给大伙看看.注意:UIImageView的大小只能跟图片一样大.要不然取色不对.- (UIColor *) getPixelColorAtLocation:(CGPoint)point { UIColor* color = nil; CGImageRef inImage = self.image.CGImage; // Create off screen bitmap context to draw the image... 阅读全文
posted @ 2011-11-17 16:47 痴人指路 阅读(536) 评论(0) 推荐(0) 编辑
摘要: http://www.devdiv.com/thread-69786-1-1.htmlUILocalNotification *notification=[[UILocalNotification alloc] init]; if (notification!=nil) { NSDate *now=[NSDate new]; //notification.fireDate=[now addTimeInterval:period]; notification.fireDate = [now dateByAddingTimeInterval:period]; ... 阅读全文
posted @ 2011-11-17 16:45 痴人指路 阅读(1519) 评论(0) 推荐(0) 编辑
摘要: http://www.cocoachina.com/bbs/read.php?tid=79243&page=e&#a如题~想要实现 javascript与objc的交互如何实现javascript调用objc内部的某一个接口呢?我是这样实现的例如某一入口<input type="button" id="enter" value="enter" onclick="testClick('printLog1:Log2:','ddddd','aaaaa');&qu 阅读全文
posted @ 2011-11-17 11:17 痴人指路 阅读(403) 评论(0) 推荐(0) 编辑
摘要: 位运算 位运算的运算分量只能是整型或字符型数据,位运算把运算对象看作是由二进位组成的位串信息,按位完成指定的运算,得到位串信息的结果。位运算符有: &(按位与)、|(按位或)、^(按位异或)、~ (按位取反)。 其中,按位取反运算符是单目运算符,其余均为双目运算符。 位运算符的优先级从高到低,依次为~、&、^、|, 其中~的结合方向自右至左,且优先级高于算术运算符,其余运算符的结合方向都是自左至右,且优先级低于关系运算符。 (1)按位与运算符(&) 按位与运算将两个运算分量的对应位按位遵照以下规则进行计算: 0 & 0 = 0, 0 & 1 = 0, 1 阅读全文
posted @ 2011-11-15 15:38 痴人指路 阅读(225) 评论(0) 推荐(0) 编辑
摘要: http://www.cocoachina.com/bbs/read.php?tid=66260最普通动画://开始动画[UIView beginAnimations:nil context:nil]; //设定动画持续时间[UIView setAnimationDuration:2];//动画的内容frame.origin.x += 150;[img setFrame:frame];//动画结束[UIView commitAnimations];连续动画:一个接一个地显示一系列的图像NSArray *myImages = [NSArray arrayWithObjects:[UIImage 阅读全文
posted @ 2011-11-14 16:12 痴人指路 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 罗朝辉(http://blog.csdn.net/kesalin)转载请注明出处在入门级别的ObjC 教程中,我们常对从C++或Java 或其他面向对象语言转过来的程序员说,ObjC 中的方法调用(ObjC中的术语为消息)跟其他语言中的方法调用差不多,只是形式有些不同而已。譬如C++ 中的:Bird * aBird = new Bird();aBird->fly();在ObjC 中则如下:Bird * aBird = [[Bird alloc] init];[aBird fly];初看起来,好像只是书写形式不同而已,实则差异大矣。C++中的方法调用可能是动态的,也可能是静态的;而ObjC 阅读全文
posted @ 2011-11-02 14:04 痴人指路 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 代码如下,在UITableViewDataSource中设置- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{NSMutableArray *arr = [[[NSMutableArray alloc] initWithCapacity:0] autorelease];[arr addObject:@"{search}"];//等价于[arr addObject:UITableViewIndexSearch];return arr;}效果图:...http://www.cocoachin 阅读全文
posted @ 2011-11-01 21:49 痴人指路 阅读(139) 评论(0) 推荐(0) 编辑