好岸园IT技术学习网 hopean.com IT新闻 js网页特效 it技术 二次开发

随笔分类 -  iphone开发

摘要:iOS UIPopOverController的使用问题今天不经意间发现了UIPopOverController的使用,使用iphone模拟器会出现Crashcrash的原因如下:'NSInvalidArgumentException', reason: '-[UIPopoverController initWithContentViewController:] called when not running under UIUserInterfaceIdiomPad.'所以必须使用ipad进行浏览,所以在代码中使用UI_USER_INTERFACE_IDIOM 阅读全文
posted @ 2012-11-30 16:42 hopeanCom 阅读(505) 评论(0) 推荐(0)
摘要:方法一:在viewDidLoad时为UIView添加操作点击打开链接UISwipeGestureRecognizer*recognizer;recognizer=[[UISwipeGestureRecognizeralloc]initWithTarget:selfaction:@selector(handleSwipeFrom:)];[recognizersetDirection:(UISwipeGestureRecognizerDirectionRight)];[[selfview]addGestureRecognizer:recognizer];[recognizerrelease];re 阅读全文
posted @ 2012-11-30 14:43 hopeanCom 阅读(633) 评论(0) 推荐(0)
摘要:iOS开发点击UIButton实现UIView的旋转更多阅读请访问http://www.hopean.comhttp://www.hopean.com首先创建界面,在viewDidLoad创建view以及button相关代码如下-(void)viewDidLoad{ [super viewDidLoad]; viewDemo = [[UIView alloc] initWithFrame:CGRectMake(0, 50, 320, 50)]; [viewDemo setBackgroundColor:[UIColor brownColor]]; UILabel... 阅读全文
posted @ 2012-11-28 10:45 hopeanCom 阅读(1910) 评论(0) 推荐(0)
摘要:更多阅读请访问http://www.hopean.com有关UIView坐标变换的,但是经常不能得到自己想要的效果,今天就把它仔细研究了下。记下来等以后忘记的时候再复习重写shouldAutorateToInterfaceOrientation:,限制某个方向会改变原点的位置,原点会一直保持在左上角,但已经不是原来的左上角了setStatusBarOrientation.改变状态栏的方向。它不会改变原点的位置,但会改变键盘的方向旋转前self.myview的frame ={0,0,320,50}CGAffineTransform at =CGAffineTransformMakeRotatio 阅读全文
posted @ 2012-11-28 10:12 hopeanCom 阅读(1338) 评论(0) 推荐(0)
摘要:先看下面的代码:更多阅读请访问http://www.hopean.com- (void)imagePickerController:(UIImagePickerController*)picker didFinishPickingMediaWithInfo:(NSDictionary*)info { NSString*mediaType = [infoobjectForKey:UIImagePickerControllerMediaType]; if([mediaTypeisEqualToString:@"public.image"]){ image= [infoobjec 阅读全文
posted @ 2012-11-27 17:18 hopeanCom 阅读(354) 评论(0) 推荐(0)
摘要:iOS 实现简单的移动UIView代码实例在iewDidLoadzh中创建UIView请访问http://www.hopean.comUIView *tmpView = [[UIView alloc] initWithFrame:CGRectMake(30.0, 30.0, 45.0, 45.0)]; tmpView.backgroundColor = [UIColor brownColor]; tmpView.tag = 100; [self.view addSubview:tmpView]; [tmpView release];实现简单的移动UIV... 阅读全文
posted @ 2012-11-27 10:54 hopeanCom 阅读(337) 评论(0) 推荐(0)
摘要:更多阅读请访问http://www.hopean.com如果要显示一个alert窗口(比如用来显示错误或警告信息、询问用户是否确认某操作等等),只要简单地创建一个UIAlertView对象,再调用其show方法即可。示意代码如下:文章出处:http://blog.csdn.net/toss156/article/details/7161667[cpp]view plaincopyUIAlertView*alertView=[[[UIAlertViewalloc]initWithTitle:@"Title"message:@"Message"delegat 阅读全文
posted @ 2012-11-26 16:33 hopeanCom 阅读(515) 评论(0) 推荐(0)
摘要:iOS开发UIWebView展示网页实例代码更多阅读请访问http://www.hopean.comUIWebView是ios内置的浏览器控件,我们可以用它来浏览网页、打开文档等等。代码如下viewController.h@interface ViewController : UIViewController<UIWebViewDelegate>{ UIWebView *webView; UIActivityIndicatorView *activityIndicatorView;}@endviewController.m- (void)viewDidLoad{ [super... 阅读全文
posted @ 2012-11-26 16:24 hopeanCom 阅读(568) 评论(0) 推荐(0)
摘要:UIWebView可以让你创建一个网页浏览器,类似safari,而不是在程序中启动safsri哦。是不是觉得很棒呢?废话少说,切入正题。一、创建UIWebView[java]view plaincopyprint?CGRectbouds=[[UIScreenmanScreen]applicationFrame];UIWebView*webView=[[UIWebViewalloc]initWithFrame:bounds];二、设置属性[java]view plaincopyprint?webView.scalespageToFit=YES;//自动对页面进行缩放以适应屏幕webView.de 阅读全文
posted @ 2012-11-26 15:22 hopeanCom 阅读(373) 评论(0) 推荐(0)
摘要:点击View的空白处UITextField取消第一响应在学习的时候会遇到这个问题,点击空白处取消了UITextField的第一响应http://www.hopean.com更多阅读请访问http://www.hopean.com相关代码如下:在viewDidLoad中创建UITextField textFieldDemo = [[UITextField alloc] initWithFrame:CGRectMake(0, 150, 130, 30)]; textFieldDemo.backgroundColor = [UIColor brownColor]; textFieldDe... 阅读全文
posted @ 2012-11-26 15:07 hopeanCom 阅读(763) 评论(0) 推荐(0)
摘要:NSString *tmpStr = [[NSString alloc] initWithString:@"abcdefg"]; NSRange range; range = [tmpStr rangeOfString:@"a"]; if (range.location != NSNotFound) { NSLog(@"found at location = %d, length = %d",range.location,range.length); }else{ NSLog(@"Not Found"); }更多阅 阅读全文
posted @ 2012-11-26 11:30 hopeanCom 阅读(453) 评论(0) 推荐(0)
摘要:方法一 入栈 UIChildDemoViewController *childView = [[UIChildDemoViewController alloc] init]; [self.navigationController pushViewController:childView animated:YES]; 出栈 [self.navigationControllerpopToRootViewControllerAnimated:YES];方法二入栈UIChildDemoViewController *childView = [[UIChildDemoViewC... 阅读全文
posted @ 2012-11-23 11:19 hopeanCom 阅读(237) 评论(0) 推荐(0)
摘要:UItableView和UISearchBar实现简单表格搜索/*********************************************************************文件名称:SingletonDemoTest.m作 者:好岸园技术学习网网 址:http://www.hopean.com创建时间: 12-11-7文件描述:作者:好岸园技术学习网网 址:http://www.hopean.com*********************************************************************/- (void)viewD. 阅读全文
posted @ 2012-11-22 17:33 hopeanCom 阅读(259) 评论(0) 推荐(0)
摘要:NSDictionary-DeepMutableCopy.h:#import<Foundation/Foundation.h>@interfaceNSDictionary(DeepMutableCopy)-(NSMutableDictionary*)mutableDeepCopy;@end类别DeepMutableCopy为NSDictionary实现新的方法,实现对NSDictionary的深层拷贝,如果只是用NSMutableDictionary, 则此对象和源对象将会指向同一个对象,对copy对象修改的话,也会同时修改源对象。NSDictionary-DeepMutableC 阅读全文
posted @ 2012-11-22 16:45 hopeanCom 阅读(648) 评论(0) 推荐(0)
摘要:在一个已排序的NSArray中搜索某一特定字符串?答案是使用CFArray自带的搜索功能:NSMutableArray *sortedArray = [NSMutableArrayarrayWithObjects:@"Alice",@"Beth",@"Carol",@"Ellen",nil];//Where is "Beth"?unsignedindex = (unsigned)CFArrayBSearchValues((CFArrayRef)sortedArray,CFRangeMake(0, 阅读全文
posted @ 2012-11-22 16:23 hopeanCom 阅读(220) 评论(0) 推荐(0)
摘要:单例模式Singleton模式的简单特点 单例模式(Singleton):保证一个类仅有一个实例,并提供一个访问它的全局访问点。有一下特点1.有一个私有的无参构造函数,这可以防止其他类实例化它,而且单例类也不应该被继承,如果单例类允许继承那么每个子类都可以创建实例,这就违背了Singleton模式“唯一实例”的初衷。2.单例类被定义为sealed(密封的),就像前面提到的该类不应该被继承,所以为了保险起见可以把该类定义成不允许派生,但没有要求一定要这样定义。3.一个静态的变量用来保存单实例的引用。4.一个公有的静态方法用来获取单实例的引用,如果实例为null即创建一个。/*********** 阅读全文
posted @ 2012-11-22 11:12 hopeanCom 阅读(275) 评论(0) 推荐(0)
摘要:1 选择工程的Target -> Build Settings -> Preprocessor Macros.如图,默认 Debug项,是“DEBUG=1”.2 在程序中设置全局宏定义在程序的 ApplicationName-Prefix.pch 文件中,加入如下,很简单#ifdef DEBUG_MODE#define DLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE_ 阅读全文
posted @ 2012-11-21 09:42 hopeanCom 阅读(870) 评论(0) 推荐(0)
摘要:iPhone开发应用中循环滚动一个UIScrollView代码实现是本文要介绍的内容,主要是介绍UIScrollView来实现循环滚动的案例,来看详细内容。//testScrollViewViewController.m//testScrollView//Createdbycashon11-7-4.//Copyright2011年xbiii3s@gmail.com.Allrightsreserved.#import"testScrollViewViewController.h"@implementationtestScrollViewViewController@synth 阅读全文
posted @ 2012-11-20 16:46 hopeanCom 阅读(432) 评论(0) 推荐(0)
摘要:IOS可以拖动的UIButton 当点击Button后,拖动到屏幕上的其它位置,Button会根据移动的方法位置发生变化[cpp] view plaincopy#import"ViewController.h"@interfaceViewController()@property(nonatomic,strong)UIButton*btn;@end@implementationViewController@synthesizebtn;-(void)viewDidLoad{[superviewDidLoad];self.btn=[UIButtonbuttonWithType: 阅读全文
posted @ 2012-11-20 16:36 hopeanCom 阅读(757) 评论(0) 推荐(0)
摘要:本文出处http://xiaominghimi.blog.51cto.com/2614927/695313原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://xiaominghimi.blog.51cto.com/2614927/695313本站文章均为李华明Himi原创,转载务必在明显处注明:转载自【黑米GameDev街区】原文链接:http://www.himigame.com/iphone-cocos2d/492.html首先申明下:希望大家转载的时候不要忘记给原文连接,看到不少论坛转载完全变成他们论坛自己原创了~ 请大家 阅读全文
posted @ 2012-11-20 16:34 hopeanCom 阅读(405) 评论(0) 推荐(0)