上一页 1 ··· 9 10 11 12 13
摘要: //// 动画和事件综合例子-键盘处理#import "ScrollView.h"@interface MJScrollView () { CGPoint _lastOffset;}@end@implementation MJScrollView#pragma mark - 生命周期方法- (id)initWithFrame:(CGRect)frame{ self = [super initWithFrame:frame]; if (self) { [self initial]; } return self;}- (id)init { if (self = [super i 阅读全文
posted @ 2013-04-28 22:09 wangzhenxiang 阅读(436) 评论(0) 推荐(0) 编辑
摘要: (UITextField *)findFirstResponder:(UIView *) view{ //遍历子视图 for(UIView *child in view.subviews){ if([child responesToSelector:@selector(isFirstResponder)] && [child isFirstResponder]){ return (UITextField *) child; } //子控件的第一响应者 UITextField *field = [self findFirstResponder: child]; if(field) 阅读全文
posted @ 2013-04-28 21:46 wangzhenxiang 阅读(168) 评论(0) 推荐(0) 编辑
摘要: UIView之所以能显示在屏幕上,完全是因为它内部的一个层,UIView本身不具备显示的功能,是它内部的层才有显示功能。创建UIView对象时,UIView内部会自动创建一个层(即CALayer对象),通过UIView的layer属性可以访问这个层。当UIView需要显示到屏幕上时,会调用drawRect:方法进行绘图,并且会将所有内容绘制在自己的层上,绘图完毕后,系统会将层拷贝到屏幕上,于是就完成了UIView的显示。shadowColor: // 阴影颜色shadowOffset = CGSizeMake(x,y):// 阴影位置shadowOpacity: // 透明度cornerRad 阅读全文
posted @ 2013-04-28 09:15 wangzhenxiang 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1. 当项目中包含大量图片,或者图片过大方法1:等比例缩小图片代码:BitmapFactory.Options options = new BitmapFactory.Options();options.inSampleSize = 4;方法2:对图片采用软引用,及时地进行recyle()操作SoftReference<Bitmap> bitmap;bitmap = new SoftReference<Bitmap>(pBitmap);if(bitmap != null){if(bitmap.get() != null && !bitmap.get(). 阅读全文
posted @ 2012-12-27 17:31 wangzhenxiang 阅读(153) 评论(0) 推荐(0) 编辑
摘要: publicclassBitmapHelper{//图片转byte publicstaticbyte[]Bitmap2BytesJpeg(Bitmapbitmap){byte[]result=null;ByteArrayOutputStreambos=newByteArrayOutputStream();if(bitmap!=null){try{bitmap.compress(Bitmap.CompressFormat.JPEG,100,bos);result=bos.toByteArray();bos.close();}catch(OutOfMemoryErrorex){ex.printSt 阅读全文
posted @ 2012-12-27 10:47 wangzhenxiang 阅读(309) 评论(0) 推荐(0) 编辑
摘要: 一、简单排序算法 由于程序比较简单,所以没有加什么注释。所有的程序都给出了完整的运行代码,并在我的VC环境下运行通过。因为没有涉及MFC和WINDOWS的内容,所以在BORLAND C++的平台上应该也不会有什么问题的。在代码的后面给出了运行过程示意,希望对理解有帮助。 1.冒泡法: 这是最原始,也是众所周知的最慢的算法了。他的名字的由来因为它的工作看来象是冒泡: #include <iostream.h> void BubbleSort(int* pData,int Count) { int iTemp; for(int i=1;i<Count;i++) { for(int j=Count. 阅读全文
posted @ 2012-09-13 16:58 wangzhenxiang 阅读(194) 评论(0) 推荐(0) 编辑
上一页 1 ··· 9 10 11 12 13