我试图在iOS7中自定义导航控制器的navigationBar,标题颜色不会改变.我正在做以下事情:
[navigationController.navigationBar setBarTintColor:[UIColor colorWithRed:46.0f/256.0f green:46.0f/256.0f blue:46.0f/256.0f alpha:1]];
[navigationController.navigationBar setTranslucent:NO];
[navigationController.navigationBar setTitleTextAttributes:@{[UIColor whiteColor]:UITextAttributeTextColor}];
[self presentViewController:navigationController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
navigationBar半透明关闭并且很暗,但标题也保持黑暗.我也尝试创建一个自定义标签,并将其设置为标题视图,运气不佳.
如何更改标题颜色?
objective-c uinavigationbar uinavigationcontroller ios7 swift
在这里使用基本目标c示例,尝试使用replaceObjectAtIndex作为数组,它似乎不起作用.
我的代码:
NSMutableArray *myArray=[NSMutableArray array];
[myArray addObject:@"First string"];
[myArray addObject:@"Second string"];
[myArray addObject:@"Third string"];
NSString *newElement=[myArray objectAtIndex:1];
NSLog(@"New object at index 1 BEFORE is %@", newElement);
[myArray replaceObjectAtIndex:1 withObject:@"Hello"];
NSLog(@"New object at index 1 AFTER is %@", newElement);
Run Code Online (Sandbox Code Playgroud)
从理论上讲,newElement的输出现在应该显示"Hello",但它仍然显示"Second String"
输出:
2012-05-30 11:21:16.638 cocoa lab[753:403] New object at index 1 BEFORE is Second string
2012-05-30 11:21:16.641 cocoa lab[753:403] New object at index 1 AFTER is Second string
Run Code Online (Sandbox Code Playgroud)
请指教
谢谢