我试图改变UITextView"文字颜色"到怀特。如果选择器保持黑色,我不在乎,但能够改变它们会很好。 (textView显示了UIPickerView选择的内容。)我正在使用StoryBoards。
我很新。这是我的.M
`#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
//@synthesize scrolly;
@synthesize Picker, PickerData;
-(void) setTorchOn:(BOOL)isOn
{
AVCaptureDevice* device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
[device lockForConfiguration:nil];
[device setTorchMode:isOn ? AVCaptureTorchModeOn : AVCaptureTorchModeOff];
[device unlockForConfiguration];
}
-(IBAction)changedState:(id)sender {
UISwitch *switchValue = (UISwitch*)sender;
[self setTorchOn:[switchValue isOn]];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// [scrolly setScrollEnabled:YES];
// [scrolly setContentSize:CGSizeMake (1, 500) ];
// [tview setTextColor:[UIColor whiteColor]];
//tview.textColor = [UIColor blackColor];
//tview.font = [UIFont systemFontOfSize:22.0];
NSArray *array = [[NSArray alloc] initWithObjects:@"Lav",@"Kitchen Sink",@"Dish Washer",@"Hose Bib",@"Water Closet",@"Soaker Tub",@"Tub Shower",@"Shower",@"Clothes Washer",@"Copper",@"Pex",@"PVC / ABS",@"Cast Iron",@"Hot Water Tanks",nil];
self.PickerData = array;
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark iAd Delegate Methods
-(void)bannerViewDidLoadAd:(ADBannerView *)banner {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:1];
[UIView commitAnimations];
}
-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1];
[banner setAlpha:0];
[UIView commitAnimations];
}
-(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView{
return 1;
}
-(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return [PickerData count];
}
-(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component{
return [self.PickerData objectAtIndex:row];
}
-(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component{
int select = row;
if (select == 0){
tview.text = @"One selected";
}
else
if (select == 1) {
tview.text = @"Two selected";
}
else
if (select == 2) {
tview.text = @"three selected";
}
else
if (select == 3) {
tview.text = @"four selected";
}
else
if (select == 4) {
tview.text = @"four selected";
}
else
if (select == 5) {
tview.text = @"four selected";
}
else
if (select == 6) {
tview.text = @"four selected";
}
else
if (select == 7) {
tview.text = @"four selected";
}
else
if (select == 8) {
tview.text = @"four selected";
}
else
if (select == 9) {
tview.text = @"four selected";
}
else
if (select == 10) {
tview.text = @"four selected";
}
else
if (select == 11) {
tview.text = @"four selected";
}
else
if (select == 12) {
tview.text = @"four selected";
}
else
if (select == 13) {
tview.text = @"four selected";
}
else
if (select == 14) {
tview.text = @"four selected";
}
}
@end
`