My UINavigationitem's TitleView getting expanded in ios 6 - ios

In my app I have applied an image on uinavigation item. It is running fine in iOS 5 but getting expanded on iOS 6. I have no left or right bar button item in navigation bar. I searched too much but couldn't find answer.
Here is my code:
UIImageView *navigationImage=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 98, 34)];
navigationImage.image=[UIImage imageNamed:#"topNav-logo.png"];
self.navigationItem.titleView=navigationImage;
and image shows like this:
It should be displayed like lower image but it is displayed like expanded in iOS 6 it works good in iOS 5.
The result is:

I have the same issue starting at iOS 6, and found the craziest workaround:
Create one more UIImageView of the same dimension. Then add the navigationImage as a subview to that. In my case this will prevent the auto resizing.
UIImageView *workaroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 98, 34)];
[workaroundImageView addSubview:navigationImage];
self.navigationItem.titleView=workaroundImageView;
If anyone finds a proper solution or an explanation please post it.

I have the following code in my project, and works fine under iOS 5 and iOS 6. Can you try this:
self.navigationItem.titleView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"topNav-logo.png"]];
Also, be sure to have both #2x and regular sizes of the image.

Related

can't customize navigationbar frame in iOS 10?

I customized the navigation bar frame(y position) so it shows on the bottom in iOS 9.x with code like:
self.navigationController.navigationBar.frame = CGRectMake(0, 320-32, oldRect.size.width, oldRect.size.height);
but it stops working in iOS 10. got something like the screenshot.the top part is covered too. Any idea how to fix this?

Rotating UILabel in iOS8

I have a UILabel which I was able to rotate using the following code in iOS 7,
self.mylabel.text = #"Search customer";
[self.mylabel setTransform:CGAffineTransformMakeRotation(-M_PI / 2)];
with reference from this thread.
However, when I tried to use the similar code in iOS 8, I got a slightly different result, whereby my string look distorted and is separated into a few lines.
In iOS 7, it displays nicely in one line at a 90 degree rotation.
I wonder anyone face the same issue as me, and how can I solve this?

Multiline label in iOS8

I have updated my device iOS to iOS 8 and now multiline label is not working. Its displaying very weird screen shot attached.
So please can you suggest me the solution.
I already set Number of lines =0 and it was working perfect in ios 7.
Not using Autolayout and story board.
This code help you.It works fine me.Edit your code according to need
UILabel *problem = [[UILabel alloc] initWithFrame:CGRectMake(40, 100, 200, 100)];
problem.lineBreakMode=NSLineBreakByWordWrapping;
problem.text=#"Please use this code it may help you it works fine for me";
problem.numberOfLines=0;
[self.view addSubview:problem];
Strangely enough, this fix doesn't work if you don't use all of it:
Set the line break mode to word wrapping (if that's the affect you want).
Set the number of lines to 0 (I had it set to 2 and it still didn't work).
Not sure if something changed here with the introduction with iOS 8 but my previous code (just setting the number of lines to 2) was working great on iOS 7.
Anyone else face a similar issue?
Do you use a custom font?Try changing the font.

UIProgressView custom track and progress images in iOS 7.1

iOS 7.1 seems to have broken the custom image properties in UIProgressView. Code that used to successfully customize progress views now yields the default appearance.
I set up a sample project that does this in viewDidLoad:
self.progressView.frame = CGRectMake(self.progressView.frame.origin.x, self.progressView.frame.origin.y, self.progressView.frame.size.width, 9);
UIImage *img = [UIImage imageNamed:#"progress_bar_fill.png"];
img = [img resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
self.progressView.progressImage = img;
img = [UIImage imageNamed:#"progress_bar_empty.png"];
img = [img resizableImageWithCapInsets:UIEdgeInsetsMake(0, 4, 0, 4)];
self.progressView.trackImage = img;
I still get the default appearance. I've stepped through and verified that img is non-nil as expected. What's going on?
UPDATE: There is an OpenRadar for this, and I've also filed a radar of my own complete with a sample project.
UPDATE 2: As noted by Axy below, you have to add this to get the JEProgressView to work correctly:
_progressBar.tintColor = [UIColor clearColor];
This is very annoying. I didn't find a way to fix this without subclassing UIProgressView.
Anyway here's how I fixed this: https://gist.github.com/JohnEstropia/9482567
You will have to change occurrences of UIProgressView to JEProgressView, including those in NIBs and storyboards.
Basically, you'd need to force assigning the images directly to the UIProgressView's children UIImageViews.
The subclass is needed to override layoutSubviews, where you adjust the heights of the imageViews according to the image sizes.
You are correct. This bug has been present since 7.1 first made its appearance in Xcode 5.1 seed 1. I submitted (and resubmitted) the same bug for all 5 seeds of Xcode 5.1, and now on Xcode 5.1. But Apple did not fix it.
Please submit this bug too! You may refer to my bug if you like: 15547259. The more the better! I regard this as serious breakage, because it means that an app that was working fine is now broken (if it uses a progress view with a progressImage).
I used John Estropia solution, but it was showing the blu tint bar in overlay to mine, with quite a strange graphical effect.
I added
_progressBar.tintColor = [UIColor clearColor];
and It went just fine. Thanks for the solution man.
Hello friends I have used the following code to add UIProgressView in my app:
UIProgressView *progressView;
progressView = [[UIProgressView alloc] initWithProgressViewStyle:UIProgressViewStyleDefault];
progressView.progressTintColor[UIColor colorWithRed:187.0/255 green:160.0/255 blue:209.0/255 alpha:1.0];
[[progressView layer]setCornerRadius:10.0f];
[[progressView layer]setBorderWidth:2.0f];
[[progressView layer]setMasksToBounds:TRUE];
progressView.clipsToBounds = YES;
[[progressView layer]setFrame:CGRectMake(30, 295, 260, 25)];[[progressView layer]setBorderColor[UIColor whiteColor].CGColor];
progressView.trackTintColor = [UIColor clearColor];
[progressView setProgress: (float)count/15 animated:YES];
Hope the code will be helpful to you, I found it here : Source of Code
I have tried to implement the JEProgressView files from John Estropia - but it doesn't work. I must have done something wrong - but I'm a little new to this. Can someone explain how exactly to do this? I know it might be a stupid question - but after a lot of googling I thought asking was the only way.
I'm also catched this bug. I tried to fix it playing with UIProgressView properties but without result. John's Estropia solution posted above, also don't work for me, maybe it's not support auto layout, so I made my own temporary solution for bypassing this bug. https://github.com/ninjaproger/AKProgressView
For me this worked for iOS version 7.1 and above for progress image:
if ([[UIDevice currentDevice] systemVersion] >= 7)
self.progressView.tintColor = [UIColor colorWithPatternImage:img];
With Xcode5 it is now possible to make resizable images with Interface Builder too. We can specify the resizing direction and content inset and select the area of to be strecthed right within the interface builder.
To avail this feature you have use Asset Catalog for the image you want to resize.

UIKeyboard not automatically translucent in iOS7

I understand that when developing in Xcode 5 with and iOS 7 project, the keyboard that pops up when interacting with a UITextField should be translucent and show through any colors in the background. This is not the case in both my projects. I have a colored & blurred background and I'm hoping for that to transpire through the keyboard; however the keyboard remains the default white/gray.
This is what I have so far as a demo:
UIColor *tintColor = [UIColor colorWithWhite:0.21 alpha:0.4];
UIColor *background = [[UIColor alloc] initWithPatternImage:[[UIImage imageNamed:#"universe.jpg"] applyBlurWithRadius:19
tintColor:tintColor
saturationDeltaFactor:1.8
maskImage:nil]];
self.view.backgroundColor = background;
UITextField *text = [[UITextField alloc] initWithFrame:CGRectMake(200, 200, 300, 60)];
[self.view addSubview:text];
I have even tried to set the keyboard appearance type to both UIKeyboardAppearanceDefault and UIKeyboardAppearanceLight
Can someone please guide/tell me on how can I achieve the keyboard translucent effect? Should this be automatic?
Thanks
EDIT 1:
I have the iPad mini, I have the iPad 3rd generation and the iPad 4th generation both with retina displays.
Running iOS 7.0.2
Your code, setup and example worked fine on my xCode. I tried first only setting the background color to something obvious like red.
self.view.backgroundColor = [UIColor redColor];
This showed through the keyboard. Afterwards I tried an image without a blur effect.
UIImageView* img = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"images.jpeg"]];
img.frame = self.view.frame;
[self.view addSubview:img];
This to showed through, but not as much as the red because the image I used was one similar to a galaxy as you stated, and therefore had a lot of black in it.
Lastly I tried your exact code, using the gaussian blur effect to create a color.
UIColor *tintColor = [UIColor colorWithWhite:0.21 alpha:0.4];
UIColor *background = [[UIColor alloc] initWithPatternImage:[[UIImage imageNamed:#"images.jpeg"] applyBlurWithRadius:19 tintColor:tintColor saturationDeltaFactor:1.8 maskImage:nil]];
self.view.backgroundColor = background;
This to also worked, but it was extreamly hard to notice. The combined affect of dark colors being blurred once by the gaussian and being blurred again by the keyboard made it almost unnoticeable. I suggest you try a similar approach to see if you are actually getting a transparent keyboard, because if the code and info you have given are correct, then it seems like you are and maybe can not see it.
Also the keyboard is only slightly transparent, so if you are expecting a full transparency then that is not the case. This slight transparency gets minimized the more uniform the background color is for instance if you had an all black or white background it would be unnoticeable.
Edit: I confirmed that this is not the case on the iPad running iOS7.0.x I get the standard all grey keyboard, even using standard apps like Safari. It seems that Apple had not optimized the transparency for such large screens and it was causing lag issues. It also seems that this is partially fixed in iOS7.1 and there are more transparent iPad features in iOS7.1, but people are recommending turning them off as they cause the iPad to run slower than normal.
iOS 7.0.3 reduced much of the translucency in navigation bars, toolbars, and the keyboard.
For navigation bars and toolbars, starting in iOS 7.0.3, you can adjust the alpha property of the UIColor set as barTintColor if you want it more translucent.
As far as public APIs go, keyboards in iOS 7, however, still have only these options:
textField.keyboardAppearance = UIKeyboardAppearanceDefault; // the default (same as light)
textField.keyboardAppearance = UIKeyboardAppearanceDark; // dark look (previously UIKeyboardAppearanceAlert)
textField.keyboardAppearance = UIKeyboardAppearanceLight; // light look
So I assume you're not getting the translucency you'd like because you're using iOS 7.0.3 or later. You can verify this by downloading an older version of Xcode and running your app in that version's simulator.
As far as private APIs, the keyboard background is made up of UIKBBackdropView and UIKBBackgroundView. You can take a look at their extracted header files here, but you should not modify these if you're submitting to the App Store. (These modifications are grounds for rejection, and also aren't documented so they could be changed in any iOS update.)
I built a simple app to test to try to find this issue, but I've been unable to replicate it except by setting IPHONEOS_DEPLOYMENT_TARGET to a lower version number like 6.0, then running on iOS 6.0. In all cases, on all iOS 7 devices and simulator, the default keyboard has a translucent blur of the content underneath it.
Perhaps you could share a picture, or a sample project?

Resources