[置顶]知道怎么学,才能学的好 (cocoachina论坛阅读笔记)
2011-08-11 17:26
791 查看
感谢cocoachina.com
添加声音[[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"xxx.xxx"]
-(BOOL)canBecomeFirstResponder; // default is NO
- (BOOL)becomeFirstResponder;
- (BOOL)canResignFirstResponder; // default is YES
-(BOOL)resignFirstResponder;
-(BOOL)isFirstResponder;
防止屏幕变黑一直亮着[UIApplication sharedApplication].idleTimerDisabled=YES;
在 不同界面对statusBar和navBar做隐藏和显示操作,他们的frame就要变化,解决方案是修改navBar的 farme,self.navigationController.navigationBar.frame = CGRectMake(0.0, 0.0, 320.0, 44.0);
UIPickerView 没有subviews 所以不能通过它的子view替换背景利用CAlayer 帮你搞定,你也可以随意的改变 UIPickerView的大小CGFloat color[4] = {1,1,0,1};
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
CGColorRef layerBounderColor = CGColorCreate(rgb, color);
CGColorSpaceRelease(rgb);
CALayer *viewLayer = pickerView.layer;
[viewLayer setBounds:CGRectMake(0, 0, 200, 200)];
[viewLayer setBackgroundColor:layerBounderColor];
[viewLayer setContentsRect:CGRectMake(0, 0, 100, 150)];
[viewLayer setBorderWidth:20];
[viewLayer setBorderColor:layerBounderColor];
CGColorRelease(layerBounderColor);
点击tabview返回到根目录
[[[tabBarController viewControllers] objectAtIndex:self.tabBarController.selectedIndex] popToRootViewControllerAnimated:NO];
gDEBugger 调试opengl
免费7天
禁用UIWebview中的超链接
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
return NO;
}
半透明状态栏与导航条的错位的解决办法
wantsFullScreenlayout
UIView覆盖到状态栏:方法的原理就是, 生成一个新的UIWindow, 把这个Window放在状态栏之上!
- (id) init
{
CGRect f=[[UIScreen mainScreen] bounds];
CGRect s=[[UIApplication sharedApplication] statusBarFrame];
self = [super initWithFrame:CGRectMake(0, 0, f.size.width, s.size.height)];
if (self != nil) {
self.windowLevel=UIWindowLevelAlert;
self.backgroundColor=[UIColor clearColor];
[self makeKeyAndVisible];
}
return self;
}
NSTask *task = [NSTask launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments];
获取本机ip地址(私有)
NSHost* myhost =[NSHost currentHost];
NSString *ad = [myhost address];
mkmapviewdelegate
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation;
每输入一个字符,这个方法会调用一次,text即是当前输入的字符
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
UITableView 选中一行后,不显示选中颜色,不要将UITableView的allowsSelection设置成NO,那样的话可能导致UITableView不能响 应点击动 作。合理的解决方法是:cell.selectionStyle = UITableViewCellSelectionStyleNone;
在iOS SDK升级到4.0后,发现Base SDK下面只有2个选择,一个是3.2,一个是4.0。SDK 3.2模拟iPad,SDK 4.0模拟iPhone。编译老项目时,XCode提示“SDK3.1(missed)”。此时只要把拷贝3.1的SDK复制到相应的目录下即可编译以前 的项目。
添加声音[[SimpleAudioEngine sharedEngine] preloadBackgroundMusic:@"xxx.xxx"]
-(BOOL)canBecomeFirstResponder; // default is NO
- (BOOL)becomeFirstResponder;
- (BOOL)canResignFirstResponder; // default is YES
-(BOOL)resignFirstResponder;
-(BOOL)isFirstResponder;
防止屏幕变黑一直亮着[UIApplication sharedApplication].idleTimerDisabled=YES;
在 不同界面对statusBar和navBar做隐藏和显示操作,他们的frame就要变化,解决方案是修改navBar的 farme,self.navigationController.navigationBar.frame = CGRectMake(0.0, 0.0, 320.0, 44.0);
UIPickerView 没有subviews 所以不能通过它的子view替换背景利用CAlayer 帮你搞定,你也可以随意的改变 UIPickerView的大小CGFloat color[4] = {1,1,0,1};
CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB();
CGColorRef layerBounderColor = CGColorCreate(rgb, color);
CGColorSpaceRelease(rgb);
CALayer *viewLayer = pickerView.layer;
[viewLayer setBounds:CGRectMake(0, 0, 200, 200)];
[viewLayer setBackgroundColor:layerBounderColor];
[viewLayer setContentsRect:CGRectMake(0, 0, 100, 150)];
[viewLayer setBorderWidth:20];
[viewLayer setBorderColor:layerBounderColor];
CGColorRelease(layerBounderColor);
点击tabview返回到根目录
[[[tabBarController viewControllers] objectAtIndex:self.tabBarController.selectedIndex] popToRootViewControllerAnimated:NO];
gDEBugger 调试opengl
免费7天
禁用UIWebview中的超链接
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
return NO;
}
半透明状态栏与导航条的错位的解决办法
wantsFullScreenlayout
UIView覆盖到状态栏:方法的原理就是, 生成一个新的UIWindow, 把这个Window放在状态栏之上!
- (id) init
{
CGRect f=[[UIScreen mainScreen] bounds];
CGRect s=[[UIApplication sharedApplication] statusBarFrame];
self = [super initWithFrame:CGRectMake(0, 0, f.size.width, s.size.height)];
if (self != nil) {
self.windowLevel=UIWindowLevelAlert;
self.backgroundColor=[UIColor clearColor];
[self makeKeyAndVisible];
}
return self;
}
NSTask *task = [NSTask launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments];
获取本机ip地址(私有)
NSHost* myhost =[NSHost currentHost];
NSString *ad = [myhost address];
mkmapviewdelegate
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation;
每输入一个字符,这个方法会调用一次,text即是当前输入的字符
- (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text
UITableView 选中一行后,不显示选中颜色,不要将UITableView的allowsSelection设置成NO,那样的话可能导致UITableView不能响 应点击动 作。合理的解决方法是:cell.selectionStyle = UITableViewCellSelectionStyleNone;
在iOS SDK升级到4.0后,发现Base SDK下面只有2个选择,一个是3.2,一个是4.0。SDK 3.2模拟iPad,SDK 4.0模拟iPhone。编译老项目时,XCode提示“SDK3.1(missed)”。此时只要把拷贝3.1的SDK复制到相应的目录下即可编译以前 的项目。
相关文章推荐
- 知道怎么学,才能学的好 (cocoachina论坛阅读笔记)
- 知道怎么学,才能学的好 (cocoachina论坛阅读笔记)
- 怎么才能知道自己电脑最大支持的内存是多少?
- mysql怎么才能知道用的是哪个配置文件
- 怎么知道别人的QQ密码,怎样才能知道别人的QQ密码
- 记住一句话,阅读优秀的代码可以知道怎么写,做项目,可以解决问题!
- [置顶] Linux协议栈代码阅读笔记(二)网络接口的配置
- 如何查看spider蜘蛛,那么怎么才能知道蜘蛛是否来过你的站?
- 有没有人知道怎么才能有积分啊。。。。
- IT行业内幕:你知道自己怎么才能最快的晋升吗?
- [置顶] 人工智能(深度学习)加速芯片论文阅读笔记 (已添加ISSCC17,FPGA17...ISCA17...)
- [置顶] Linux协议栈代码阅读笔记(一)
- 【转】一个域名是用哪里的DNS来解析的,电脑怎么知道找哪一个DNS呢? 我注册域名的时候会在服务商那里配置DNS解析,一般需要24小时后才能访问,我想知道,解析后的这个数据是不是会同步到世界上所有的DNS服务器呢!如果不是,当我访问我的这个域名的时候,电脑怎么知道去找到我注册的这一家的DNS服务器呢,谁告诉他的呢?
- 怎么才能知道我点击了cell上的按钮所对应的是那一行的cell
- 阅读笔记_我们应当怎么做需求分析
- 网摘精灵教程:怎么才能知道网摘精灵的宣传效果
- [英语阅读]清晨怎么做才能提神
- 在MAC系统里添加开机启动任务(但是怎么才能知道自己程序的固定位置呢?)
- 构建之法阅读笔记02
- thinking in java 阅读笔记 第三章 程序控制流程