您的位置:首页 > 职场人生

[置顶]知道怎么学,才能学的好 (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复制到相应的目录下即可编译以前 的项目。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  职场 休闲
相关文章推荐