Tag: ios7

iOS 7和button和边框

我正在使我的应用程序准备好iOS7。 我做了转换,并与用户合作。 应用程序中的button看起来不像button。 看起来很平坦。 有没有办法把边框放在一边,或者像button一样放置呢?

UIProgressView在iOS 7.1中自定义跟踪和进度图像

iOS 7.1似乎已经打破了UIProgressView的自定义图像属性。 现在用于成功定制进度视图的代码产生默认外观。 我在viewDidLoad设置了一个样例项目: self.progressView.frame = CGRectMake(self.progressView.frame.origin.x, self.progressView.frame.origin.y, self.progressView.frame.size.width, 9); UIImage *img = [UIImage imageNamed:@"progress_bar_fill.png"]; img = [img resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)]; self.progressView.progressImage = img; img = [UIImage imageNamed:@"progress_bar_empty.png"]; img = [img resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)]; self.progressView.trackImage = img; 我仍然得到默认的外观。 我已经通过并validationimg是非零,如预期。 这是怎么回事? 更新:有一个OpenRadar为此,我也提交了我自己的一个示例项目完整的雷达。 更新2:正如下面的Axy所述,你必须添加这个让JEProgressView正常工作: _progressBar.tintColor = [UIColor clearColor];

iOS上使用MKMapSnapshotter的VectorKit崩溃报告

我得到了与VectorKit和MKMapSnapShotter相关的不同types的崩溃报告。 崩溃发生的相当随机,但似乎是从背景返回时发生的最多。 设备在发生之前不会发出任何内存警告。 这里发生了什么事? 我在用着: if (!_snapshotQueue) { _snapshotQueue = dispatch_queue_create("com.bestappever.snapshot", DISPATCH_QUEUE_SERIAL); } [_snapshotter cancel] _snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options]; __weak __typeof(self)__self = self; [_snapshotter startWithQueue:queue completionHandler:^(MKMapSnapshot *snapshot, NSError *error) { dispatch_async(dispatch_get_main_queue(), ^{ __strong __typeof(__self)_self = __self; [_self doSomething]; }); }]; 最常见的如下: Thread 11 Crashed: 0 libobjc.A.dylib 0x38502b66 objc_msgSend + 5 1 VectorKit 0x35bc8997 -[VKTileProvider […]

iOS 7:禁用整个应用程序的UINavigationBar半透明

有没有办法来禁用整个应用程序的UINavigationBar半透明? 我知道使用[self.navigationController.navigationBar setTranslucent:NO]可以解决这个问题的单个控制器,但我有很多UINavigationBars在我的应用程序,这是一个非常乏味的解决scheme。 我试过[[UINavigationBar appearance] setTranslucent:NO] ,但是这个function令人惊讶地不被支持。 这样做会导致Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** Illegal property type, c for appearance setter, _installAppearanceSwizzlesForSetter:' 如果我有,我可以通过我的整个应用程序设置UINavigationBars禁用半透明一个接一个,但必须有一些更优雅的解决scheme,这个问题…

如何在UILabel中findCGRect文本的子string?

对于一个给定的NSRange ,我想在UILabel中find一个对应于该NSRange的字形的NSRange 。 例如,我想在“快速的棕色狐狸跳过懒狗”一句中find包含“狗”一词的CGRect 。 诀窍是, UILabel有多行,文本是真正的attributedText文本,所以要findstring的确切位置有点困难。 我想写在我的UILabel子类上的方法看起来像这样: – (CGRect)rectForSubstringWithRange:(NSRange)range; 详情,对于那些有兴趣的人: 我的目标是能够创build一个具有UILabel的确切外观和位置的新UILabel,然后我可以进行animation制作。 其余的我已经知道了,但是特别是这一步让我暂时陷入困境。 到目前为止,我所做的努力来解决这个问题: 我希望在iOS 7中,会有一些文本工具包可以解决这个问题,但是大多数我见过的使用Text Kit的例子都集中在了UITextView和UITextField ,而不是UILabel 。 我看到另一个关于Stack Overflow的问题,可以解决这个问题,但是接受的答案已经超过两年了,而代码对于归因文本performance不佳。 我敢打赌,正确的答案涉及以下其中之一: 使用标准的文本工具包方法在一行代码中解决这个问题。 我敢打赌,它会涉及NSLayoutManager和textContainerForGlyphAtIndex:effectiveRange 编写一个复杂的方法,将UILabel分解成行,并且可能使用Core Text方法在行内find字形的矩形。 我现在最好的select是分开@ mattt的优秀TTTAttributedLabel ,它有一个方法可以在一个点find一个字形 – 如果我反转,find一个字形的点,可能工作。 更新:这里有一个Github的要点,我已经尝试到目前为止,以解决这个问题的三件事情: https : //gist.github.com/bryanjclark/7036101

如何在iOS 7上启动时更改状态栏的样式

当我启动我的应用程序,它显示启动图像和黑色的状态栏。 我怎样才能改变它,使发射过程中状态栏是亮的? 我已经在我的AppDelegate didFinishLoading方法中设置了状态栏的外观,并且适用于其他应用程序。

如何使图像和标签自定义UIBarButtonItem?

我想制作一个包含图像和文本的自定义UIBarButtonItem,如下所示: 我试着inheritanceUIBarButtonItem并覆盖这个方法: – (UIView *)customView { if (!self.storedView) { UIView *temp = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 120, 44)]; UIImageView *tempImageView = [[UIImageView alloc] initWithImage:self.image]; tempImageView.frame = CGRectMake(0, 0, self.image.size.width, self.image.size.height); UILabel *tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(44, 0, 100, 44)]; tempLabel.text = @"text"; [temp addSubview:tempImageView]; [temp addSubview:tempLabel]; self.storedView = temp; } return self.storedView; } 我这样使用它: UIBarButtonItem […]

如何在更新标题时防止UIButton闪烁

当我在UIButton上调用setTitle时,button会在iOS 7中闪烁。我尝试设置myButton.highlighted = NO,但是这并没有阻止button闪烁。 [myButton setTitle:[[NSUserDefaults standardUserDefaults] stringForKey:@"elapsedLabelKey"] forState:UIControlStateNormal]; myButton.highlighted = NO; 以下是我如何设置更新标题的计时器: – (void)actionTimer { if (myTimer == nil) { myTimer = [NSTimer scheduledTimerWithTimeInterval: 1.0 target: self selector: @selector(showActivity) userInfo: nil repeats: YES]; } } 以下是实际更新标题的方法: – (void)showActivity { NSString *sym = [[NSLocale currentLocale] objectForKey:NSLocaleCurrencySymbol]; if (pauseInterval == nil) { // Update clock seconds […]

为什么UIViewController在UINavigationBar下扩展,而UITableViewController没有?

我有UITabbarController和UINavigationController在里面。 我有一个UIView的子类,我分配为navController的UIViewController的navController 。 这是非常标准的东西,对吧? 这是我如何做到的 _productCategoryView = [[ProductCategoryView alloc] initWithFrame:self.view.frame]; self.view = _productCategoryView; 这个view有一个UITableView作为子subView _productCategoryTableView = [[UITableView alloc] initWithFrame:self.frame style:UITableViewStylePlain]; _productCategoryTableView.separatorStyle = UITableViewCellSeparatorStyleNone; _productCategoryTableView.backgroundColor = [UIColor clearColor]; [self addSubview:_productCategoryTableView]; 为了debugging的目的,我在视图上设置了self.backgroundColor = [UIColor blueColor] 。 从上面的tableView初始化可能会认为视图和表格的frame是一样的。 但是,当我在iOS 7运行时,视图的原点被设置在UINavigationBar后面。 这是可以理解的,因为我设置self.navigationBar.translucent = YES; 在我的UINavigationController子类。 但是我不明白的是桌子坐在navBar下方? 它不应该从navBar后面的(0, 0) navBar吗? 请参见下面的截图Scenario 1 。 注意navBar背后的蓝色色调 现在,我只需使用[self.navigationController pushViewController…..]来[self.navigationController pushViewController…..]导航堆栈上的另一个viewController 。 再次我有一个自定义的UIView与在其中的tableView 。 […]

如何在iOS7中更改UISearchBar的背景颜色

如何更改iOS7中的UISearchBar的背景颜色? 不是灰色的,我想改变我的uinavigationbar颜色 如果我使用这个代码,这是什么出来 searchBar.backgroundColor = [UIColor redColor]; 那不是红色! 这与导航栏的背景颜色完全相同的情况。