Remove UINavigationController rounded corners - iphone

How can i remove the UINavigationController top rounded corners?Is there any plist property or i need to do this programmatically?
I want to go from this:
To this:

Just change the status bar style from "Black Opaque" to "Black Translucent" and all 4 corners of your rootViewController won't be rounded anymore. As long as you don't set your view controller's property wantsFullScreenLayout = YES nothing will be drawn behind the status bar. Your UIWindow must have backgroundColor = [UIColor blackColor] so the user can't notice that the status bar isn't real "Black Opaque".

Well, the default look is the look in the image on the bottom. So what did you do, to get the look of the top image in the first place? My guess is, that you use an image as the background of the UINavigationBar. Find the image and replace it with a version without rounded corners.
An alternative is a UINavigationBar subclass. In that case you might look for that subclass and see if there is a line similar to [self.layer setCornerRadius:3.0] and remove it.

I believe Sascha may be correct when he says that rounded corners are automatically added when you use a black status bar. I noticed that in one of my new apps, my UINavigationController had rounded corners and a black status bar, even though i had not set it in the xib file, the info.plist file or even the App Delegate.
I did a quick test and swapped the image I was using for the UINavigationController/NavigationBar background and discovered that the nav bar color was automatically affecting the status bar, which in turn was rounding the corners of the nav bar (weird)
See snapshots of my nav bar (The rounded corners are being generated purely by virtue of the color of the image I am using as my UINavigationController's background!)
So I guess in your case - One suggestion would have been to try a different color background and see if you have the same results as I did.

Related

UISearchBar background fading in and out when segue push animates

I created two views that has its transition controlled by a navigation view controller. I have a UIView which contain a UISearchBar. The UIView is then set as the navigation bar's titleView in the first view.
Now, the problem is, whenever I go from the first view to the second view, I can see a light background behind the UISearchBar fading in and out.
I have did a bit of troubleshooting of my own and found that the background belongs to the UISearchBar and not the UIView that contains it. I have also tried many codes to make the UISearchBar background transparent, but none of the codes actually makes it transparent.
Edit: I did a bit more fiddling and found that the colour fading in and out is the colour from the style/tint of the UISearchBar. So if I change the tint to black, it'll darken instead. The only way I see I can fix this is to turn the background of the UISearchBar's alpha to 0, but I can't find any code that can change the alpha of a UISearchBar in a UINavigationBar.
Edit: I really can't find any code to turn the background tint of the UISearchBar to be alpha 0. Does anyone have a workaround or an alternative solution to this?
I realised that the bar is actually the scope bar's background. I'm not sure why it still showed up even though I disabled it. My solution was to set the background image as a transparent image.
[self.searchBar setScopeBarBackgroundImage:[UIImage imageNamed:#"transpixel.png"]];

How to make tableview's content displayed under a transparent navigation bar?

How to make tableview's content displayed under a transparent navigation bar?
Like this:In "Photos" app, albums displayed under navigation bar.
Special thanks
If you use _rootNavigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; then set correct tableview frame thats it. If you are in xib dont forget to simulate the translucent navigation bar.
One way I have found to accomplish this is by shifting your tableview's superview up to have the origin at {0, 0}. However after researching more several people have said altering the superview (UIViewControllerWrapperView) is a bad idea. However I also have not found any information on why just changing the frame would create problems. I am shifting the superview right now and haven't found any problems related to it yet.
Might be you can set it like this:
[navigationBar setAlpha:0.5f];
For making the navigation bar transparent alone, you can check this post, How to make a Navigation bar transparent and fade out like in the photo app in the iPhone
Also check this How to set the transparency color for Toolbar and Navigation bar using MonoTouch?
I am not sure whether you can add the table view behind the navigation bar. You might have to add it as a subview of self.parentViewController.view.
Another way to do this is by hiding navigation bar and using a transparent tool bar in place of that. This can be added on top of the current view. The only problem is with the back button. You might have to use custom button for that.

How to set the Transparent statusbar in iphone

In my application i want to set the statusbar transparent.There are three styles are possible for changing the style of the statusbar.
gray
black
black translucent
mycode:
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent];
How to set the transparent statusbar?
The best solution for this problem is to set self.wantsFullScreenLayout = YES; in your view controller and [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; for your status bar.
UPDATE:
As Mihir Oza told in comments the UIStatusBarStyleBlackTranslucent constant from old version of my answer is now deprecated. Use UIStatusBarStyleLightContent instead.
For the global app in the info.plist add Status bar style: Transparent Black Style (alpha 0.5).
The best way of doing this is with info.plist. Have a look at Apple's UIKit pList keys, specifically UIStatusBarStyle (and the value UIStatusBarStyleBlackTranslucent) for making it translucent, or the UIStatusBarHidden key (for hiding it totally).
It's not possible to make the status bar transparent. There are only 3 possible styles (gray, black and black translucent) you can set and you cannot get the bar's UIView.
However if you have static content behind it (i.e. a fixed part of your UI that you can edit) you can set the status bar to black translucent and add a 50% white layer just behind the bar. This makes the bar appear to be transparent.
Here's an example of what I mean.
See an example http://cl.ly/7WST/Untitled-1.png
In the info.plist set status bar style Transparent black style (alpha of 0.5).
In viewcontroller.xib set size fullscreen and status bar none.
In viewcontroller.m add following codes in viewWillAppear:
self.view.frame = CGRectMake(0,0,320,480);
This worked for me.
You can only hide the status bar using Status bar is initially hidden property in your info.plist

Annoying white border when rotating a view in iPad

When rotating a View from UIInterfaceOrientationPortrait to UIInterfaceOrientationPortraitUpsideDown on the iPad simulator, there is a white border along one side of the view (see diagram, lower left of the image). The white border shows only on one side, but not the opposite side. How can I prevent (hide) it? Thanks!
This is a guess:
It's possible that one of your views has a backgroundColor set to white, and it is completely covered by another view. During a rotation, perhaps floating point errors cause one border to show slightly through that edge.
To investigate this case, you can use the undocumented method [UIView recursiveDescription] to get a quick look at your view hierarchy (no need to submit code with that method, it's just for debugging). Once you know which views are near the bottom, you can print out their backgroundColors, or just set them all to [UIColor clearColor].
Also, I'm guessing you already know this one, but it can be useful to set window.backgroundColor = [UIColor clearColor] at the start of your code!
I had the same issue. I saw that in Interface builder autosizing for the view could not be enabled. I deleted the .xib and re-created it making sure product was set to "ipad" when creating the file (add new file in xcode).
You can also set the background color to nil. From the UIView documentation for backgroundColor:
The default value is nil, which results in a transparent background
color.
UIWindow inherits from UIView, so this works as well. Probably a good idea to use nil, in case [UIColor clearColor] isn't always the best way to do it.
The funny thing is, I have a project with no nibs, so I create the UIWindow in code, but the background color was white before I set it to nil. is the default background color of a programmatically created UIWindow white?

Black corners on UITableView Group Style

I have a problem where my UITableView (group style) has a black "tip" above it's rounded corner.
I'm setting up the background of the tableview like so:
[meetingTableView setBackgroundColor:[[UIColor alloc] initWithPatternImage:[[UIImage alloc] initWithContentsOfFile:#"background.png"]]];
And my table view ends up looking like this:
black pointy edge on rounded corner http://papernapkin.org/pastebin/resource/images/imageEntryId/6487
Any ideas how I can get rid of those black points?
I have got the same problem.
When I set clear color by xib, I have the back corner
The solution is to set it by code !
(The same problem with interface builder exist for webviews)
Try this in your controller's viewDidLoad method:
meetingTableView.backgroundColor = [UIColor clearColor];
You'll get Black corners on UITableView Group Style if you set background color to clear color in XIB.
Instead try this code for removing Black corners on UITableView Group Style
tableViewObject.backgroundColor=[UIColor clearColor];
Just in case you weren't already aware, there's another neat technique you can use to make customized backgrounds for UITableViews:
Not quite as simple as setting the background as you're doing, but it gives you a lot more flexibility and can scale to any table size.
Maybe if you put yourTableViewOutlet.backgroundView=nil;
To avoid the black corners you have to make sure that the UITableViewCells are not opaque. It looks like you're using custom styles table cells and the default value for opaque is YES. Either go to Interface Builder and uncheck the opaque checkbox if the table cell was set up in a XIB file. Or use the setOpaque:NO setter to change value.
Because the table cell view still has a rectangular frame even with the rounded corners the cell view and not the actual table view is causing those black corners.
My guess is that it's related to something that you're doing in your custom table view cells. You might want to experiment with setting the cell background color to [UIColor clearColor].
I think you should set the background color of your table as clearColor and initialsie your view with the background image.
Then it will definitely not show the black corners. But also don't forget to set the background color of your cell as white color
The up-voted answer above (set the tableView's background to [UIColor clearColor]) may not work for you if you are like me and never use the UITableViewController, instead putting a UITableView inside a UIViewController.
In this case it's not the tableView that needs to have a clear background, but the view that holds the tableview.
This is not intuitive, but it works for me. In interface builder you can just set the parent view's background color to clear color, or you could do the same in code in viewDidLoad with:
self.view.backgroundColor = [UIColor clearColor];
I'm guessing the reason for the black corners is something about the internal graphics optimization, and setting the background clear fixes it.