How to apply autolayout to UISegmentedControl in tabelviewcell (Storyboard) without coding in xcode?
Attached image below
Attached image for reference
Related
I've got a view-based NSTableView. I'm trying to understand the problem of why I cannot position / resize the NSTextField that resides in the NSTableCellView. I believe this problem is related to the intrinsic content size. Therefore I modified the Content Hugging and Compression Resistance to prioritise hugging. Please see screenshots of IB and the results when running the app.
Purple rectangle is the Custom View.
Im having trouble resizing content inside static cells to fit different iPhone screen sizes.
Looking at the image below you can see that the UIPickerView and Sign In UILabel both did not resize in width.
I've tried adding code to the ViewDidLoad like so
self.signUp.frame = CGRectMake(0,0,self.view.frame.size.width,self.signUp.frame.size.height);to programmatically adjust their sizes but nothing changed.
I also tried adding equal width constraints to make it match the UITableViewCell contentView width and that did nothing as well.
Same issues happens to all UILabels (Membership,Schedule,Method...) and UITextFields (Comments)
This is all occurring in a UITableViewController.
How can I get it to resize?
Apples freeform UIViewController and UITableView are externally useful in this circumstance.
If you design your app in the storyboard, before applying constraints make sure the UIViewController's size is freeform (big square that doesn't match any screen size).
Then add constrains.
When you run the app, the app will resize properly.
I have a custom UICollectionViewCell class that sets the background view of the cell to a downloaded image and also a UILabel added to it that sits neatly at the bottom of the cell and is slightly transparent (this label is the title of the image). It looks great in portrait but when I rotate my device to landscape the UILabel stays in its position while the custom cell resizes itself to better fit the screen. I have my UILabel fully constrained to the cell so I don't know why it isn't resizing to always fit the width of the cell whether the device is in portrait/landscape.
I've attached these pictures below to better illustrate what exactly is happening:
I figured it out - for anyone who is also wondering the same thing, this is what I did:
I overrode the layoutSubviews method in my custom UICollectionViewCell class and forced my UILabel to stick to width and bottom of the cell.
It was weird because before I upgraded to xCode 6 and iOS 8 this was working perfectly without the need of this solution (the constraints within the storyboard worked), but now I had to use this approach.
Cheers!
I want to remove the horizontal separator line between a UITabBar and the rest of the screen. I'm asking the same question as this guy but updated for iOS7.
Setting the background image of my UITabBar doesn't alleviate the problem, nor does setting the background image of the [UITabBar appearance] object.
Is this still possible in iOS7? If so, how?
You could also hide shadow line using this code:
[self.tabBar setValue:#(YES) forKeyPath:#"_hidesShadow"];
Swift
self.tabBar.setValue(true, forKey: "_hidesShadow")
The answer to this is pretty much the same as removing the separator of a navigation bar or a toolbar.
Officially, this is only possible by setting the shadowImage to an empty image. However, a closer look at the documentation, we see that:
For a custom shadow image to be shown, a custom background image must
also be set using the backgroundImage property. If the default
background image is used, then the default shadow image will be used
regardless of the value of this property.
By using a custom background image, you would lose the blurred background translucency.
The separator is a UIImageView that is a subview of the tab bar. You can find it in the tab bar's hierarchy and set it to hidden.
This solution uses a transparent image, so it is more preferable.
Swift
tabBar.shadowImage = UIImage()
Objective-C
tabBar.shadowImage = UIImage.new;
I have settings View which is a View Object under self.view.
I added the background image as: self.settingsView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"settings_bg__650x740.png"]];
The problem is, it is having extra images at the bottom. This only happens in iOS 7.
Here's the screenshot:
Please, help me to solve.
The image is being tiled. Why are you creating a tiled image and using it as a background color? Just put the image in a UIImageView and add the image view to the view.
try resize your image before adding to background.
You can find answer in here
Stretching a image in iOS using colorWithPatternImage
the settings view's bound size is higher than the background color referred image. so, the image will tile to fill the settings view.