相关疑难解决方法(0)

更改UISegmentedControl的字体大小

任何人都可以告诉我如何更改字体类型和大小UISegmentedControl

iphone cocoa-touch font-size uisegmentedcontrol ios

217
推荐指数
7
解决办法
10万
查看次数

更改UISegmentedControl的文本颜色

作为目标c的新手,需要在UIsegmentControl中更改所选段的文本颜色.使用以下代码.

 [[UIsegmentControl.subviews objectAtIndex:segment.selectedSegmentIndex] setTintColor:[UIColor redColor]];
Run Code Online (Sandbox Code Playgroud)

它改变了段颜色.请帮我...

xcode objective-c

10
推荐指数
3
解决办法
2万
查看次数

iPhone应用程序崩溃:UIKit

2015年10月29日更新:可能找到了原因.我正在根据这个StackOverflow帖子创建一个渐变层- 它对我和我测试过的其他人来说都很好,但是其他人可能会遇到问题吗?

CAGradientLayer * g  = [CAGradientLayer layer];
UIColor * colourFrom = [UIColor colorWithRed:0.1 green:0.7 blue:0.3  alpha:1.0];
UIColor * colourTo   = [UIColor colorWithRed:0.1 green:0.8 blue:0.4 alpha:1.0];

g.frame        = self.view.bounds;
g.cornerRadius = 10;
g.startPoint   = CGPointMake(0.0, 0.5);
g.endPoint     = CGPointMake(1.0, 0.5);
g.colors       = [NSArray arrayWithObjects:(id)[colourFrom CGColor],
                                           (id)[colourTo CGColor],
                                           nil];
Run Code Online (Sandbox Code Playgroud)

2015年10月27日更新:仍然看到来自Crashlytics的这些崩溃.


2015年10月26日更新:我发现StackOverflow上的这个帖子似乎与我所拥有的问题完全相同(但没有答案......),但他们使用的是Facebook/Twitter活动表,我不是.只是帮助诊断问题的东西.


刚刚向App Store发布了一个应用程序,我们在Crashlytics中看到了一小部分用户(约2%)崩溃:

它似乎只出现在iOS 9中,但它正在所有设备上发生.

致命异常:NSInternalInconsistencyException在这种情况下仅支持RGBA或白色空格.

就个人而言,我正在运行带有9.1的iPhone 6,但我没有遇到这个问题.我也尝试过模拟器,但没有问题,所以我不确定这个bug是如何实际出现的.来自Crashlytics的堆栈跟踪如下.

好像UIColor是在NSDictionary没有编码的情况下将a添加到a 中,但我在应用程序中的任何地方都没有这样做.它似乎也可能与某些事情有关UIRemoteViewController,但我没有在应用程序中使用它(除非使用Facebook登录导致 - 我尝试使用Facebook登录手机和模拟器,但我再也无法得到出现此错误). …

iphone objective-c uikit ios

8
推荐指数
1
解决办法
1077
查看次数

UISegmentedControl仅在重新访问ViewController时更改文本颜色

更新回答.由我.

目前我的文字颜色变化有问题UISegmentedControl; 它需要在第一次加载时更改UIControlStateSelected.代码有效,但只是有条件的.当您在导航栏上使用分段控件访问页面,点击后退按钮,然后再次访问该页面时,它可以正常工作.我假设这里有继承问题.让我解释..

分段控件的位置位于导航栏的顶部.

包含SegmentedControl的ViewController的继承: TabBarViewController(使用AppDelegate管理) - >导航控制器 - > ViewController(其中'inviteSegBar'所在的位置)

这是AppDelegate.m中的代码:

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithHexString:@"#669900"]];//this one sets it green.
[[UINavigationBar appearance] setBackgroundColor:[UIColor whiteColor]];
Run Code Online (Sandbox Code Playgroud)

这里是viewDidLoad:包含'inviteSegBar'的VC 的代码UISegmentedControl,问题是:

- (void)viewDidLoad
{
    [super viewDidLoad];

    //CUSTOM APPEARANCE <below>
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    self.navigationController.navigationBar.tintColor = [UIColor colorWithHexString:@"#669900"];

    inviteSegBar.tintColor = [UIColor colorWithHexString:@"#333333"];

    [[UISegmentedControl appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor colorWithHexString:@"#669900"]} forState:UIControlStateSelected];
}
Run Code Online (Sandbox Code Playgroud)

就像我说的最后一行有效,但只有当你重新访问该页面时.为什么会这样?

PS这是同样的问题,我已经在列出任何答案之前尝试过此代码.

objective-c uisegmentedcontrol uicolor ios

6
推荐指数
3
解决办法
1万
查看次数