摘要:1 [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISearchBar class]]] setTintColor:[UIColor whiteColor]]; 2 [[UIBarButtonItem appearanceWhenContainedInInstancesOfClasses:@[[UISear...
阅读全文
摘要:问题: scrollView 滑动与系统右滑返回的边缘手势冲突时,返回手势失效 解决方案 思路就是: 右滑返回优先. 当触发到右滑返回手势时就取消 scrollView的手势 OC版 [self.contentScrollView.panGestureRecognizer requireGestur
阅读全文
摘要:在iOS开发中经常会用到label,可以多行显示,但是当数据少的时候可能没有那么多行,就会在中间显示,如果想让它在左上对其,似乎要费一番功夫,一下是我总结的三种方法。 - (void)viewDidLoad { [super viewDidLoad]; NSString *string=@"为了测试
阅读全文
摘要:方法1: 方法2: 开发中可能会有改变这个按钮背景色的需求,如微信的通讯录左滑备注按钮就是灰色的,实现这个需求我们需要自定义cell,在自定义的cell中重写layoutSubviews这个方法,找到UITableViewCellDeleteConfirmationView修改它的背景色即可。
阅读全文
摘要:1 NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIColor redColor] forKey:NSForegroundColorAttributeName]; 2 [self.navigationItem.rightBarButtonItem setTitleTextAttributes:dic forState:UIC...
阅读全文
摘要:1.iPhone尺寸规格 设备 iPhone 宽 Width 高 Height 对角线 Diagonal 逻辑分辨率(point) Scale Factor 设备分辨率(pixel) PPI 3GS 2.4 inches (62.1 mm) 4.5 inches (115.5 mm) 3.5-inc
阅读全文
摘要:1 - (BOOL)isEmpty:(NSString *) str 2 { 3 if (!str) 4 { 5 return true; 6 } 7 else 8 { 9 NSCharacterSet *set = [NSCharacterSet whitespaceAndNewlineCharact...
阅读全文
摘要:1 UIView *view_bg = [[UIView alloc]initWithFrame:cell.frame]; 2 view_bg.backgroundColor = UIColorFromRGB(0xFFFFFF, 1); 3 cell.selectedBackgroundView = view_bg;
阅读全文
摘要:#pragma mark - 播放语音 -(void)play:(NSString *)word { // AVSpeechSynthesisVoice *voice = [AVSpeechSynthesisVoice voiceWithLanguage:@"zh-HK"]; AVSpeechSynthesisVoice *voice = [AVSpeechSynthesi...
阅读全文
摘要:十六进制转换成十进制 或 十进制转换成十六进制
阅读全文
摘要:在UITableView上添加了UITapGestureRecognizer后会导致didSelectRowAtIndexPath失效,原因是UITapGestureRecognizer会截取了tableView的touch事件,导致无法响应行选择,解决方法是重写UIGestureRecognize
阅读全文
摘要:@property (weak, nonatomic) IBOutlet UISearchBar *searchBar; - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [self performSelector:@selector(setCorrectFocus) wi...
阅读全文
摘要:NSString *telString = [[dict objectForKey:@"send_user_info"] objectForKey:@"tel"]; UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"拨打电话...
阅读全文
摘要:// Add a new ALAssetsGroup to the library. // The name of the ALAssetsGroup is name and the type is ALAssetsGroupAlbum. The editable property of this
阅读全文
摘要:1 NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; 2 [formatter setDateStyle:NSDateFormatterMediumStyle]; 3 [formatter setTimeStyle:NSDateFormatterShortStyle]; 4 [format...
阅读全文
摘要:前几天项目中用到UIWebView, 而在网页中,用到了建行缴费。但是在缴费的时候出现“请您在浏览器中清理并设置接受服务器下传的cookie,错误码0130Z1108006”,而安卓是没有这种情况的,于是就在找原因。找了很久也没有找到原因。一开始想到的是没有加载建行的cookie,于是打印cooki
阅读全文
摘要:UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; backButton.frame = CGRectMake(16, 40, 45, 45); [backButton addTarget:self action:@selector(splashBack:) forContr...
阅读全文
摘要:1.为了适配 iOS9.0 中的 App Transport Security(ATS)对 http 的限制,这里需要对 支付宝的请求地址 alipay.com 做例外,在 app 对应的 info.list 中添加如下配置 (文中以 XML 格式描述)。 2.同时需要在Plist中设置支付宝为白名
阅读全文