
ios开发小技巧
GeforceLee
这个作者很懒,什么都没留下…
展开
-
UIWebView禁止下拉弹跳功能
for (id subview in tWebView.subviews){ if ([[subview class] isSubclassOfClass:[UIScrollView class]]) { ((UIScrollView *)subview).bo原创 2011-08-30 11:38:43 · 1805 阅读 · 0 评论 -
iphone实现复制粘贴效果
UIPasteboard *paste = [UIPasteboard generalPasteboard];paste.string = @"a";原创 2011-09-22 16:09:33 · 930 阅读 · 0 评论 -
Prefix.pch文件
常量写在Prefix.pch文件里,这样用的时候就不用写#import了原创 2011-08-25 17:49:15 · 1060 阅读 · 1 评论 -
UIImage加载图片节省内存方法
不要用[UIImage imageNamed:@"a.png"].用 [UIImage imageWithContentsOfFile:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathCompone原创 2011-08-25 17:45:56 · 1688 阅读 · 0 评论 -
tabbar改变颜色
CGRect frame = CGRectMake(0.0, 0, 320, 48); UIView *v = [[UIView alloc] initWithFrame:frame]; [v setBackgroundColor:[UIColor renColo原创 2011-09-22 16:25:18 · 1089 阅读 · 0 评论 -
排序问题
NSMutableArray *ma1 = [[NSMutableArray alloc] init]; [ma1 addObject:@"2"]; [ma1 addObject:@"1"]; [ma1 addObject:@"3"];原创 2011-09-22 23:00:40 · 1358 阅读 · 0 评论 -
UISearchBar和UISearchDisplayController
今天第一次用UISearchBar+UISearchDisplayController感觉非常神奇。以前都是只用searchbar。看到苹果自带的搜索都是有黑色界面如图:确不知道怎么实现的 今天就用了UISearchBar+UISearchDisplayContro原创 2011-09-22 18:05:28 · 12738 阅读 · 5 评论 -
iPhone开发经典语录集锦
前言:iPhone是个极具艺术性的平台,相信大家在开发过程中一定有很多感触,希望能写出来一起交流,所以开了这个帖子,以后还会维护。 如果大家和我一样有感触的话,可以跟在帖子下面,最好简短并附上中英文:) 1:如果无法保证子类行为的一致性,那么就用委转载 2011-08-27 22:17:11 · 558 阅读 · 0 评论 -
UINavigationController跳转到UITabBarController和UITabBarController跳转到 UINavigationController
1。 UINavigationController 到 UITabBarController在准备跳转 tabbarviewcontroller 的窗体中添加 tabbarviewcontroller ,配置到各tabitem 属性在执行事件里写 [self.na转载 2011-08-28 09:53:35 · 1446 阅读 · 1 评论 -
禁用textfield的联想功能
TextField.autocorrectionType = UITextAutocorrectionTypeNo;原创 2011-08-30 18:49:43 · 1679 阅读 · 0 评论 -
tableview中定义某个cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ if(indexPath.row == 0) { ret原创 2011-08-31 10:36:54 · 633 阅读 · 0 评论 -
在window上旋转
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) { [self.view setBounds:CGRectMake(0, 0, 1024, 768)]; [self.view原创 2011-09-28 10:33:11 · 654 阅读 · 0 评论 -
UserDefault
To reset the NSUserDefaults to the standard values use:[NSUserDefaults resetStandardUserDefaults];[NSUserDefaults standardUserDefaults];If you want to delete every key use the following:NSDict原创 2011-12-06 18:39:31 · 1098 阅读 · 0 评论 -
UIImageView实现touch功能
继承UIImageView在子类写touch方法。原创 2011-08-25 17:59:15 · 989 阅读 · 2 评论 -
SegmentControl点击切换View
[segmentControl_ addTarget:self action:@selector(segmentChangedValue:) forControlEvents:UIControlEventValueChanged];- (void)segmentChanged原创 2011-09-17 23:14:32 · 7154 阅读 · 0 评论 -
判断当前的机型
[UIDevice currentDevice] model]可以判断机型;[UIDevice currentDevice] currentMode] 判断屏幕分辨率;if (UI_USER_INTERFACE_IDIOM() == UIU原创 2011-09-01 16:53:58 · 783 阅读 · 0 评论 -
编辑textfield是view向上移动
- (void)textFieldDidBeginEditing:(UITextField *)textField{ self.view.frame = CGRectMake (0,-100,self.view.frame.size.width, self.原创 2011-09-05 10:26:29 · 783 阅读 · 0 评论 -
遮挡tabbar,navigation的方法
弹小框,但也要整个屏幕大小UIWindow* window = [UIApplication sharedApplication].keyWindow; if (!window) { window = [[UIApplication sharedApplication]原创 2011-09-05 16:46:45 · 1221 阅读 · 1 评论 -
view旋转
- (void)tarnsFormLoginView:(UIView *)pView{ UIInterfaceOrientation state = [[UIApplication sharedApplication] statusBarOrientation]; if (s原创 2011-09-06 15:12:30 · 715 阅读 · 0 评论 -
随机数
- (NSString *)randomString { const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; char rv[11]; fo原创 2011-09-06 18:39:59 · 409 阅读 · 0 评论 -
navigation自定义title
UILabel *label = [[[UILabel alloc] initWithFrame:CGRectZero] autorelease]; label.backgroundColor = [UIColor clearColor]; lab原创 2011-09-09 12:28:40 · 579 阅读 · 0 评论 -
将UIColor转换为RGB值
//将UIColor转换为RGB值- (NSMutableArray *) changeUIColorToRGB:(UIColor *)color{ NSMutableArray *RGBStrValueArr = [[NSMutableArray alloc] in转载 2011-09-09 10:18:49 · 1874 阅读 · 0 评论 -
navigation自定义barbuttonitem
UIButton *tBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 52, 31)]; [tBtn setBackgroundImage:kImageNavigationBlackButton forState:U原创 2011-09-09 12:00:08 · 3004 阅读 · 0 评论 -
正则表达式
正则表达式用于字符串处理、表单验证等场合,实用高效。现将一些常用的表达式收集于此,以备不时之需。匹配中文字符的正则表达式: [\u4e00-\u9fa5]评注:匹配中文还真是个头疼的事,有了这个表达式就好办了匹配双字节字符(包括汉字在内):[^\x00-\xf原创 2011-09-11 20:07:03 · 385 阅读 · 0 评论 -
compare
NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:@"White",@"Blue",@"Red",@"Black",nil]; [array sortUsingSelector:@select转载 2011-09-10 11:13:53 · 1715 阅读 · 0 评论 -
改变badgeValue
改变其他viewcontroller 的tabbar 的 badgeValueUIViewController *tController = [self.tabBarController.viewControllers objectAtIndex:2];原创 2011-09-15 16:48:03 · 6187 阅读 · 0 评论 -
根据UILabel内容调节UILabel的大小
UILabel *lab = [[UILabel alloc]init];NSString *labValue = @"1234";CGSize labFrame = [labValue sizeWithFont:font constrainedToSize:cgsize原创 2011-09-02 11:45:56 · 860 阅读 · 1 评论 -
判断当前系统版本
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0) { // iOS 5 code } else { // iOS 4.x code }记得加#import "sys/utsname.h"原创 2011-12-17 13:54:37 · 1077 阅读 · 0 评论