This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How to adjust UIToolBar left and right padding
As you see in the attached picture1, there is a bit of padding of some kind preventing the UIButton from going all the way to the right.
How do I position the button all the way to the right so it's touching the right of the screen?
Use flexible Space Bar Button before the button in xib or Storyboard.
Related
This question already has answers here:
How to Apply Gradient to background view of iOS Swift App
(30 answers)
Closed 4 years ago.
I am trying to create a UILabel that will have a gradient background color. I am wondering if there is a way to do this through the interface builder. If not, is there a way to accomplish this programmatically using the Swift programming language?
Any input or suggestions are greatly appreciated.
Thanks in advance.
You actually can't put directly a gradient layer in a UILabel, since the text will dissapear. See Adding a CGGradient as sublayer to UILabel hides the text of label
You can use an UIView, put your UILabel inside it, and then add the gradient layer to the UIView like this.
How to Apply Gradient to background view of iOS Swift App
While not the same question, it seems the answer to this may help:
How to Apply Gradient to background view of iOS Swift App
You have to create a gradient layer and insert it as a sublayer programmatically.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
iOS SDK: Moving the button into the center of screen by code
UIImageView. Zoom and Center to arbitrary rectangle. Can’t determine correct center on screen
I'm trying to centralise an UIActivityIndicator in a UIWebView(which in turn is a subView of a UIScrollView, which also has a UIToolbar element to the left - although the left-toolbar isn't always visible)
Similar questions have been asked before, but the point is in finding the center "dynamically" i.e. on change of orientation as well as presence or absence of the left toolbar.
What's the best approach? Is there any better way to do this than overriding the method shouldAutorotateToInterfaceOrientation?
Center of what btw?
You can access the UIViewController's center as self.view.center
or in your case, UIWebView's center as yourwebView.center
And by giving it resizing elements of top left, activityindicator would center it-selves always.
EDIT :
If you want center of the screen that would be gained by frame like
Consider activity indicator of width and height 30, 30.
(([UIScreen mainScreen].bounds.size.width)/2 - 15, ([UIScreen mainScreen].bounds.size.height)/2 - 15, 30, 30);
Then, set autoresizing elements to none.
Go to size Inspector and remove all the arrows from the Auto-sizing feature.
There can be not general solution to your question. This is because only you know what element in your view you want to ignore or not. The view always stays the same, no matter what element you add to it. So, I suggest getting a rectangle for the part of the view you consider as clear/empty/available and setting your loading indicator in that. Just get the view's whole frame (self.view.frame.size.height) and substract any elements from there. For example
MyIndicator *indicator = [[MyIndicator alloc] initWithFrame:CGRectMake(self.toolbar.frame.size.width + self.toolbar.frame.origin.x, self.topBar.frame.size.height + self.topBar.frame.origin.y, self.view.frame.size.width - self.toolbar.frame.size.width - self.toolbar.frame.origin.x, self.view.frame.size.height - self.topBar.frame.size.height - self.topBar.frame.origin.y)];
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Disable UITableView horizontal scroll
Please can any one tell me how to disable horizontal scrolling of tableview..
Kindly help..
If your tablecontentview width is same as your view width it will not scroll in horizontal way but if you want that your tableview should not bounce then you can disable bouncing of your tableview as
m_TableView.bounces = NO;
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to animate the background color of a UILabel?
I'm pretty new to animating things on iOS and have a basic question.
I have a UILabel that I want to briefly change the color of. Basically, inside of cellForRowAtIndexPath: I am reloading my cell's every 15 seconds or so. If a certain cell meet's a requirement, I want to briefly change the label's color and animate it to fade off back to it's original color.
Pop on, fade out.
Any tips would be amazing. Thanks guys.
This isn't the brightest solution, but it might get you to what you need: Create an identical, new UILabel with the same frame, font, etc... but with a different color. Use the animatable "alpha" property to fade your old color out and it will seem as if the underlaying label's color is being transitioned in.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
How to set this Layout in iPhone need Some help
I draw image in imageview.
I have one image view and Button is there.
When i draw something it show like this,
I dont wan't to show drawing on that button.
How can i do that?
There are 2 approaches:
1) You can do this IB:
Drag your UIImageView in IB to bottom of your stack subviews of view where your UIView (where you are drawing) is placed.
2) You can do this in code:
Push your view on the top of views using following method
- (void)bringSubviewToFront:(UIView *)view
For example:
UILabel * labelgreen;
[labelgreen.superview bringSubviewToFront:labelgreen];