Uibutton titlelabel shadowoffset property is not behaving properly in ios 7 - ios

I am using the below code to get a shadow to button title label.
theCuLabel.titleLabel.shadowColor=[UIColor blackColor];
theCuLabel.titleLabel.shadowOffset=CGSizeMake(-3.0,2.5);
In IOS 6 its working properly like below
But in IOS 7 its not working as expected like below
I didn't find solution for this, can any one tell me the solution or any update in IOS 7 that happened for this.
Thanks in Advance...

[button setTitleShadowColor:[UIColor blackColor] forState:UIControlStateNormal];
this is the correct method to set the shadow color for a UIButton.
I have tried this and is working in all versions.

Related

setTitleTextAttributes not working after view on screen. iOS 11

I've spent a whole day trying to change the colour of a UIBarButtonItem and now i'm thinking it is an iOS 11 bug unless someone can tell me it's by design.
I can change the colour of the text by using this code
[self.refreshButton setTitleTextAttributes:#{NSForegroundColorAttributeName: [UIColor orangeColor]} forState:UIControlStateNormal];
If I add the code to the viewWillAppear:animated function it works fine, however if you add it to viewDidAppear:animated it does not work.
It seems to work on the iOS 9 simulator, but not iOS 11.
Has something changed in this regard in iOS 11?
If all you want to do is change the title color of your UIBarButtonItem you can set the tintColor property instead of setTitleTextAttributes:. If you want all of your UIBarButtonItems to have the same title color you can set the tintColor of your tool/navigation bar.
I had the same issue on iOS11 but needed to set the font by setTitleTextAttributes. Unfortunately this does also not work by appearance. The only solution I found was to create new BarButtonItems as copy of the old ones and then set them as navigationItem.rightBarButtonItems.
For reference for other users having the same issue.
This Stack Overflow answer may explain why the method doesn't work.
An improper setting of UIControlState() may be the problem.

UISlider behaviour in iOS7 versus iOS6

I noticed that UISlider in iOS7 behaves differently than it did in iOS 6 and iOS 5:
Say you have a slider with min=0 and max=10, current value is 0. When you first touch the "knob", a valueChanged message is sent with slider.value=0.269 (instead of the expected 0) and the knob moves towards the middle. Generally, touching the slider moves it towards the middle value (5 in this example), the farther out from the middle it currently is, the more it moves.
All this did not happen in iOS6, and I'd like to restore the old behaviour, but have no idea how to achieve this.
Apple has not commented on my bug report yet, but I've found a solution more or less by accident: installing a custom image for the knob restores the behaviour from iOS 6:
[self.slider setThumbImage:[UIImage imageNamed:#"knob"] forState:UIControlStateNormal];
On iOS 9 you need to set for .Normal, .Selected and .Highlighted states to work. I found this after 5h of struggling. Way to go Apple!
[_sliderView setThumbImage:[UIImage imageNamed:#"knob"] forState:UIControlStateNormal];
[_sliderView setThumbImage:[UIImage imageNamed:#"knob"] forState:UIControlStateSelected];
[_sliderView setThumbImage:[UIImage imageNamed:#"knob"] forState:UIControlStateHighlighted];
I tested it and can confirm the described behavior.
Interestingly, when the app is built using the iOS 6 SDK but the device/simulator still runs iOS 7 (in compatibility mode) the bug does not occur. So it seems that it's connected to the new look.
File a bug.

UIButton shows default white background with round corners in IOS 6 but no in IOS 7

I need a code that removes this default background, in IOS 7 there isn't a problem since I don't see this background.
If you choose a button of type UIButtonTypeCustom, there will be no default background
Try this,
UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeCustom];
In iOS 7 default UIButton is like hyperlink in web page, with transparent background and no boarders. iOS 7 is actually border less now, If you want to have corners and backgrounds like iOS 6 use custom button. UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom] Now you can set background and other things if you want.

IOS 7 Button Background Does Not Work

I have a project that comes from IOS6, and now with the button changes of the IOS7 I had to make a background to my project buttons. Although, when I try to set a background image for my buttons it doesn't work! programming or not it doesn't work!
I tryied:
[buttonOutlet setBackgroundImage:[UIImage imageNamed:#"lineStyleScreen.png"] forState:UIControlStateNormal];
and the IDE! BOTH DONT WORK!!!
I wonder if it is because I did't updated my storyboard to IOS7.
ios 7 doesnt support regular ios 6 buttons. Do follow this link:
http://dev.iachieved.it/iachievedit/?p=127
Is the button type set to Custom in properties inspector?
Try to set the tint color to the button for iOS 7
button.tintColor = [UIColor greenColor];
Note:- set the tint color that will suit to your requirement

Back button is not visible in iOS 7

I have some weird trouble about iOS 7. I have an UINavigationBar in my app and it works perfect for iOS 6;
-- IOS 6 --
However, when i try to run it on iOS 7, my back button disappeared. It's there, still working and clickable but not visible;
-- IOS 7 --
How can I fix this problem ?
Setting BackButtonBackgroundImage via UIAppearance currently has some odd behavior in iOS 7. This is probably related to the updated design, which replaces the rect-style button with a backIndicatorImage (an arrow).
This leaves 3 options for customizing the back button's appearance:
Change the color of the backIndicatorImage by setting the tintColor property on UINavigationBar (or one of its superclasses).
Set the new backIndicatorImage property on UINavigationBar to a custom image. (don't forget to set the backIndicatorTransitionMaskImage as well or it won't work)
Create a custom UIBarButtonItem and manually assign it as UINavigationItem's leftBarButtonItem. (See the answer mentioned above by Mashhadi)
By the way, if you have to keep support ios 6 version like me, use that;
if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_6_1)
{
// My iOS 6 back button background
self.navigationController.navigationBar.tintColor = [UIColor colorWithRed:39.0f/255.0f green:184.0f/255.0f blue:199.0f/255.0f alpha:1.0];
}
else
{
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
}
I used Wes Dearborn's answer and implemented a nice way of supporting both iOS5+'s back button and iOS7's backIndicatorImage:
Back button strangely disappearing in UINavigationController but keeps working

Resources