Sportica   Sportica

随笔分类 -  objective-c

上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要://在 工程下的target - Build Phases --Link Binary With Libraries --添加AudioToolbox.framework //然后在头文件中声明#import <AudioToolbox/AudioToolbox.h> //声音提示#define SOUNDID 1109 //1012 -iphone 1152 ipad 1109 ipad- (IBAction)voiceBtnPress:(id)sender { //一句话解决iphone ipad 声音提示 AudioServicesPlaySystemSo... 阅读全文
posted @ 2012-09-29 11:57 qingjoin 阅读(6432) 评论(0) 推荐(0) 编辑
摘要://NSMutableDictionary 与 NSMutableArray注意的地方-(void)testDic{ //初始化 NSMutableDictionary *dic = [[NSMutableDictionary alloc]init]; NSMutableDictionary *dic1 = [[NSMutableDictionary alloc]init]; NSMutableArray *arr = [[NSMutableArray alloc]init]; //在里面添加数据 [dic setObject:@"qingjoin" for... 阅读全文
posted @ 2012-09-29 10:21 qingjoin 阅读(4584) 评论(0) 推荐(0) 编辑
摘要://UIColor *color1 = [UIColor colorWithPatternImage:[UIImage imageNamed:@"left1.png"]]; //UIColor *color2 = [UIColor colorWithPatternImage:[UIImage imageNamed:@"left2.png"]]; //[contactBookBtn setBackgroundColor:color1]; [contactBookBtn setBackgroundImage:[UIImage imageNamed:@&quo 阅读全文
posted @ 2012-09-25 09:45 qingjoin 阅读(4073) 评论(0) 推荐(0) 编辑
摘要://判断当前输入法-(void)textViewDidChangeSelection:(UITextView *)textView{ NSLog(@"wewe:%@",[[UITextInputMode currentInputMode] primaryLanguage]);//do something en-US为英文。。zh-hans为中文 /* if ([[[UITextInputMode currentInputMode] primaryLanguage] isEqualToString: @"en-US"]) { NSLog(@"en 阅读全文
posted @ 2012-09-12 13:46 qingjoin 阅读(2753) 评论(0) 推荐(0) 编辑
摘要://在遇到有输入的情况下。由于现在键盘的高度是动态变化的。中文输入与英文输入时高度不同。所以输入框的位置也要做出相应的变化#pragma mark - keyboardHight-(void)viewWillAppear:(BOOL)animated{ [self registerForKeyboardNotifications];}-(void)viewWillDisappear:(BOOL)animated{ [[NSNotificationCenter defaultCenter] removeObserver:self];}- (void)registerForKeyboa... 阅读全文
posted @ 2012-09-12 13:43 qingjoin 阅读(41242) 评论(2) 推荐(2) 编辑
摘要://当用到UITableView 时。往往背景图片要根据内容的大小而定。但如果不用stretchableImageWithLeftCapWidth。刚图片拉出来会很难看。//图片自动适应内容大小 UIImage *chatImage=[UIImage imageNamed:@"bubble.png"]; chatImage = [chatImage stretchableImageWithLeftCapWidth:22 topCapHeight:14]; NSLog(@"tbvContentSizeForLines:%f",... 阅读全文
posted @ 2012-09-10 22:34 qingjoin 阅读(315) 评论(0) 推荐(0) 编辑
摘要://下拉列表动画加载-(void)dropDownListAnimation{ SchoolInHandAppDelegate *app = [[UIApplication sharedApplication]delegate]; //每行的高度 everyListHight = 30; listHight = userCountInFile*everyListHight; presstimes ++; if(_dropDownbackView ==nil) { _dropDownbackView = [[UIScrollView all... 阅读全文
posted @ 2012-09-07 09:26 qingjoin 阅读(2887) 评论(0) 推荐(0) 编辑
摘要://保存用户名和密码-(void)saveAccountOrPwd{ NSMutableDictionary *recorder = [NSMutableDictionary dictionary]; [recorder setObject:loginName.text forKey:LOGIN_NAME]; NSMutableArray *array = [[NSMutableArray alloc]init]; //array = [NSMutableArray arrayWithContentsOfFile:LOGIN_RECORDEDFILE]; ... 阅读全文
posted @ 2012-09-06 13:37 qingjoin 阅读(3137) 评论(1) 推荐(0) 编辑
摘要:UIActivityIndicatorView *_aiView; //用来加载动画 UIButton *_clickMask; //button//加载动画-(void)loginAnimationActivityIndicatorView{ _clickMask = [UIButton buttonWithType:UIButtonTypeCustom]; [_clickMask setFrame:[UIScreen mainScreen].bounds]; [self.view addS... 阅读全文
posted @ 2012-09-05 21:28 qingjoin 阅读(3237) 评论(0) 推荐(0) 编辑
摘要://设置选中的方式。一共有三种。cell.selectionStyle = UITableViewCellSelectionStyleNone;//三种效果typedef enum { UITableViewCellSelectionStyleNone, UITableViewCellSelectionStyleBlue, UITableViewCellSelectionStyleGray} UITableViewCellSelectionStyle;//选中后的字体颜色设置 cell.resultTableContent.highlightedTextColor = [UI... 阅读全文
posted @ 2012-09-05 18:11 qingjoin 阅读(3121) 评论(0) 推荐(0) 编辑
摘要://用于向上偏移高度,也就是说隐藏tableView前面高度为50的区域。不让它显示。。[Tableview setContentInset:UIEdgeInsetsMake(-50, 0, 0, 0)]; 阅读全文
posted @ 2012-09-03 20:21 qingjoin 阅读(6827) 评论(0) 推荐(0) 编辑
摘要://以前一直不知道多线程是个什么东西,为什么要用到线程。直到项目里遇到请求XML时。当数据加载或刷新时界面就会卡。也就是主线程堵塞。后来终于把这个问题给解决了。 //初始化 _operationQueue = [[NSOperationQueue alloc]init];//设置每秒请求一次 。在这里selector:@selector(threadTestN)后面注意如果threadTestN没有带冒号,表示这个方法不带参数。如果带上了冒号":"表示这个方法是有参数的 NSTimer *timer = [NSTimer scheduledTimerWithTimeInte 阅读全文
posted @ 2012-08-31 11:57 qingjoin 阅读(1094) 评论(0) 推荐(0) 编辑
摘要:xcode->preferences->text editing->display options->show line numbers 阅读全文
posted @ 2012-08-30 16:40 qingjoin 阅读(244) 评论(0) 推荐(0) 编辑
摘要://开始触发键盘-(BOOL)textViewShouldBeginEditing:(UITextView *)textView{ return YES;}//在触发键盘之前可以触发一些必要的事件。-(void)textViewDidBeginEditing:(UITextView *)textView{ NSLog(@"Begin");/* UIBarButtonItem *done = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self.. 阅读全文
posted @ 2012-08-30 14:00 qingjoin 阅读(2852) 评论(0) 推荐(0) 编辑
摘要://设置tableViewcell里uilabel、图片高度 CGSize tbvContentSizeForheight = [cell.resultNoticeTableContent.text sizeWithFont:cell.resultNoticeTableContent.font]; CGSize tbvContentSizeForLines = [cell.resultNoticeTableContent.text sizeWithFont:cell.resultNoticeTableContent.font constrainedToSize:CGSizeMak... 阅读全文
posted @ 2012-08-30 09:36 qingjoin 阅读(824) 评论(0) 推荐(0) 编辑
摘要:contentSize是scrollview可以滚动的区域,比如frame = (0 ,0 ,320 ,480) contentSize = (320 ,960),代表你的scrollview可以上下滚动,滚动区域为frame大小的两倍。contentOffset是scrollview当前显示区域顶点相对于frame顶点的偏移量,比如上个例子你拉到最下面,contentoffset就是(0 ,480),也就是y偏移了480contentInset是scrollview的contentview的顶点相对于scrollview的位置,例如你的contentInset = (0 ,100),那么你的 阅读全文
posted @ 2012-08-27 20:12 qingjoin 阅读(3897) 评论(0) 推荐(0) 编辑
摘要:今天突然遇到了一个这样的错误。Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ContentViewController 0x4528a0> setValue:forUndefinedKey:]:this class is not key value coding-compliant for the key digitPressed弄了半天,代码也没有错误。后来还是找到了。是因为。当前的这个视图。View有一些控件有多余的关联。把它删除掉就行了。第一次 阅读全文
posted @ 2012-08-27 18:24 qingjoin 阅读(298) 评论(0) 推荐(0) 编辑
摘要://在- (void)viewDidLoad方法中加入//加载后自动定位到某一行 NSIndexPath *idxPath = [NSIndexPath indexPathForRow:8 inSection:0];//定位到第8行 [self.resultCommunityTableview scrollToRowAtIndexPath:idxPath atScrollPosition:UITableViewScrollPositionMiddle animat... 阅读全文
posted @ 2012-08-24 15:48 qingjoin 阅读(3024) 评论(0) 推荐(0) 编辑
摘要:UIColor *color = [UIColor colorWithPatternImage:[UIImage imageNamed:@"半透明title.png"]]; uilabel.backgroundColor = color; 阅读全文
posted @ 2012-08-15 17:28 qingjoin 阅读(681) 评论(0) 推荐(0) 编辑
摘要://最先进的是这个 返回一共有多少行!- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ NSLog(@"111"); tableView.contentInset = UIEdgeInsetsMake(0, 0, -144, 0); //AppDelegate为一个代理类。 AppDelegate *app = [[UIApplication sharedApplication]delegate]; int count = [app.... 阅读全文
posted @ 2012-08-10 16:45 qingjoin 阅读(619) 评论(0) 推荐(0) 编辑

上一页 1 ··· 3 4 5 6 7 8 9 下一页
  Sportica