摘要:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string;{ if ([string isEqualToString:@"n"]) { return YES; } NSString * toBeString = [textField.text stringByReplacingCharactersInRange:range withString:string]; //... 阅读全文
摘要:
- (IBAction)touchReadButton:(id)sender { NSData *jsonData = [[NSData alloc] initWithContentsOfFile:JSON_PATH]; NSError *error = nil; id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&error;]; ... 阅读全文
摘要:
for (UIView * thebtn in [self.view subviews]) { if ([thebtn isKindOfClass:[UIButton class]]) { //***改变字体颜色 [(UIButton *)thebtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; //***改变背景 [(UIButton... 阅读全文
摘要:
/** * @brief 冒泡排序法 * * @param arr 需要排序的数组 */-(void)BubbleSort:(NSMutableArray *)arr{ // 取第一个与其邻接的对比,若大则交换 for (int i=0; ii; j--) { int temp1 = [[arr objectAtIndex:j]intValue]; int temp2 = [[arr objectAtIndex:j-1]intValue]; if (temp1 temp2) // 从大到... 阅读全文
摘要:
需要导入如下frameworklibxml2.2.dyliblibz.1.2.5.dylibMobileCoreServices.frameworkSystemConfiguration.frameworkCFNetwork.frameworkHeader Search Paths 加入/usr/include/libxml2 阅读全文
摘要:
Setthe UIViewControllerBasedStatusBarAppearancetoNOin theInfo.plist.InViewDidLoadmethod or anywhere, where do you want to change status bar style:[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 阅读全文
摘要:
- (void)viewDidLoad{ [super viewDidLoad]; // Do any additional setup after loading the view. self.title = @"拷贝文件到Sandbox"; //文件类型 NSString * docPath = [[NSBundle mainBundle] pathForResource:@"save1" ofType:@"dat"]; // 沙盒Documents目录// NSString * appDir = [NSSearchPathFor 阅读全文
摘要:
- (void)requestMapListData{ NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@""]]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; [request setDelegate:self]; request.timeOutSeconds = 20.f; [request startAsynchronous];}- (void)requestFinished:(ASIHTTPReques... 阅读全文
摘要:
textField.leftView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 8, 0)] autorelease]; textField.leftView.userInteractionEnabled = NO; textField.leftViewMode = UITextFieldViewModeAlways;// Text 垂直居中textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter; 阅读全文
摘要:
UIView *bgColorView = [[UIView alloc] init];[bgColorView setBackgroundColor:[UIColor redColor]];[cell setSelectedBackgroundView:bgColorView];[bgColorView release]; 阅读全文