Ios 如何设置按钮的标题颜色?

Ios 如何设置按钮的标题颜色?,ios,objective-c,uibutton,uiimage,uicolor,Ios,Objective C,Uibutton,Uiimage,Uicolor,在按钮上放置图像时,如何设置按钮的标题颜色。任何人都可以帮我解决这个问题。。 我的代码如下所述: startLoginBtn = [[UIButton alloc]initWithFrame:CGRectMake(25, 303, 267, 40)]; [startLoginBtn setImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal]; [startLoginBtn setTitle:@"Sta

在按钮上放置图像时,如何设置按钮的
标题颜色
。任何人都可以帮我解决这个问题。。 我的代码如下所述:

startLoginBtn = [[UIButton alloc]initWithFrame:CGRectMake(25, 303, 267, 40)];
[startLoginBtn setImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal];
[startLoginBtn setTitle:@"Start Login" forState:UIControlStateNormal];
[startLoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startLoginBtn addTarget:self action:@selector(startLogin:) forControlEvents:UIControlEventTouchUpInside];
[startLoginBtn setEnabled:YES];
[self.view addSubview:startLoginBtn];

将您的图像作为背景图像

使用以下代码

startLoginBtn = [[UIButton alloc]initWithFrame:CGRectMake(25, 303, 267, 40)]; 
[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal]; 
[startLoginBtn setTitle:@"Start Login" forState:UIControlStateNormal]; 
[startLoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startLoginBtn addTarget:self action:@selector(startLogin:) forControlEvents:UIControlEventTouchUpInside];
[startLoginBtn setEnabled:YES]; 
[self.view addSubview:startLoginBtn];

将您的图像作为背景图像

使用以下代码

startLoginBtn = [[UIButton alloc]initWithFrame:CGRectMake(25, 303, 267, 40)]; 
[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal]; 
[startLoginBtn setTitle:@"Start Login" forState:UIControlStateNormal]; 
[startLoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startLoginBtn addTarget:self action:@selector(startLogin:) forControlEvents:UIControlEventTouchUpInside];
[startLoginBtn setEnabled:YES]; 
[self.view addSubview:startLoginBtn];

将您的图像作为背景图像

使用以下代码

startLoginBtn = [[UIButton alloc]initWithFrame:CGRectMake(25, 303, 267, 40)]; 
[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal]; 
[startLoginBtn setTitle:@"Start Login" forState:UIControlStateNormal]; 
[startLoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startLoginBtn addTarget:self action:@selector(startLogin:) forControlEvents:UIControlEventTouchUpInside];
[startLoginBtn setEnabled:YES]; 
[self.view addSubview:startLoginBtn];

将您的图像作为背景图像

使用以下代码

startLoginBtn = [[UIButton alloc]initWithFrame:CGRectMake(25, 303, 267, 40)]; 
[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal]; 
[startLoginBtn setTitle:@"Start Login" forState:UIControlStateNormal]; 
[startLoginBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[startLoginBtn addTarget:self action:@selector(startLogin:) forControlEvents:UIControlEventTouchUpInside];
[startLoginBtn setEnabled:YES]; 
[self.view addSubview:startLoginBtn];

您不应将
setImage
用于按钮,只需使用
-[UIButton setBackgroundImage:forState:][/code>

您不应将
setImage
用于按钮,只需使用
-[UIButton setBackgroundImage:forState:][/code>您不应将
setImage
用于按钮,只需使用
-[UIButton setBackgroundImage:forState:][/code>

您不应该将
设置图像
用于按钮,只需使用
-[UIButton setBackgroundImage:forState:][/code>

[startLoginBtn setImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal];
换成

[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal];
换成

[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal];
换成

[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal];
换成

[startLoginBtn setBackgroundImage:[UIImage imageNamed:@"SkipLogin.png"] forState:UIControlStateNormal];

你也可以试试这个

    UIButton *Button = [UIButton buttonWithType:UIButtonTypeCustom];
  [ Button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [Button addTarget:self action:@selector(YourMethodName:) forControlEvents:UIControlEventTouchUpInside];
    [sectionView addSubview:Button];
    view.backgroundColor = [UIColor clearColor];

你也可以试试这个

    UIButton *Button = [UIButton buttonWithType:UIButtonTypeCustom];
  [ Button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [Button addTarget:self action:@selector(YourMethodName:) forControlEvents:UIControlEventTouchUpInside];
    [sectionView addSubview:Button];
    view.backgroundColor = [UIColor clearColor];

你也可以试试这个

    UIButton *Button = [UIButton buttonWithType:UIButtonTypeCustom];
  [ Button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [Button addTarget:self action:@selector(YourMethodName:) forControlEvents:UIControlEventTouchUpInside];
    [sectionView addSubview:Button];
    view.backgroundColor = [UIColor clearColor];

你也可以试试这个

    UIButton *Button = [UIButton buttonWithType:UIButtonTypeCustom];
  [ Button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [Button addTarget:self action:@selector(YourMethodName:) forControlEvents:UIControlEventTouchUpInside];
    [sectionView addSubview:Button];
    view.backgroundColor = [UIColor clearColor];

你试过了吗?使用图像将覆盖标题,只需使用背景图像,它将覆盖在你的标题下。希望这能有所帮助。当我阅读他的问题时,直到页面刷新,我才看到你的答案:D@LalitKumar我敢肯定你今天过得不好,伙计。做些运动,睡一觉。:)你试过了吗?用图片覆盖标题,就可以了使用backgroundimage,它将位于您的标题下。希望这能有所帮助。当我阅读他的问题时,直到页面刷新,我才看到您的答案:D@LalitKumar我敢肯定你今天过得不好,伙计。做些运动,睡一觉。:)你试过了吗?用图片覆盖标题,用背景图片,标题下会有。希望如此我可以帮忙。当我读到他的问题时,直到页面刷新,我才看到你的答案D@LalitKumar我敢肯定你今天过得不好,伙计。做些练习然后睡觉。:)你试过了吗?用图片覆盖标题,用背景图片覆盖标题。希望这能有所帮助。当我读到他的问题时,我没有看到你的answer,直到页面刷新为止:D@LalitKumar我敢肯定你今天过得不好,伙计。只是做些运动,睡一觉。:)嘿,我是说,我们不必重复同一个答案,我们可以在第一个问题上给出正确答案。嘿,我是说,我们不必重复同一个答案,我们可以在第一个问题上给出正确答案。嘿,我是说我的意思是,我们不必重复同一个答案,我们可以对问题给出的第一个正确答案进行投票。嘿,我的意思是,我们可以对问题给出的第一个正确答案进行投票