ios visually resize image in a table view cell - ios

I am new to ios and am working on creating a table view with custom table view cell. I am running into a very simple problem. I am trying to resize an image visually within a custom table view cell (the table view cell content outlets are linked to a custom class). However, I am unable to resize either the labels or the image. Following screen shot is that of my storyboard view and the image. Any ideas if I am missing something? Thanks!

You need to put the name of your custom class on Class property of TableViewCell like the image. If it does not work, let we know more about the code.

Is this a Static Cell? If you have a UIImageView in your custom cell then you should be able to load the image and IOS will automatically size your image.

This may be a bug in my Xcode Version 5.0 (5A11365x. When I switch to Xcode 4.5.2, I am able to resize the labels. I am developing for ios 7.0. I will download the latest Xcode for ios 7 and see if that fixes the issue.
UPDATE
Yes looks like it is an Xcode bug. I just installed latest Xcode Version 5.0 (5A1412) and it allows you to adjust the label and image sizes.

Related

Constraints Problems with table view cell

I have problems with constraints in table view cell. As you can see in the image above , I tried to constrain the label on the far right so that label will be closer to the right right edge. But that isn't reflecting on the ipad in preview. Whats wrong? and How do solve this problem ? Thanks for any help !
The prototype cell in the storyboard is just that: a prototype. It isn't "real". It will be used as a cell when the app runs, and layout will occur. But the Preview in the storyboard in Xcode (in your version of Xcode) doesn't reflect any of that.
So the only way to see the effect of your constraints is to build and run the app in an appropriate Simulator.

Auto-layout features not working in a table view cell in xcode?

I am making a simple app since I'm quite new to xCode. I have a table view which holds cells. I've added constraints that I was hoping would dynamically change the width of the cell depending on the device (iphone vs iPad). However, it doesn't seem to be working.
I believe I've set all the necessary constraints, but I guess I must be missing some.
Here is an image of what I'm working with:
And this is the problem, when I change the size of the device I'm working on, the labels in the cell don't resize themselves.
Here are the constraints I'm currently using:
Any help would be appreciated, thanks.
Most probably you haven't updated the frames after changing the size of the view controller

iOS tableview appearing empty in UiBuilder

I'm using a long tableview. All of the cells are visible when I run the simulation but in the UIBuilder, only the top visible cells are showing. When I scroll further down through the table in UIBuilder, the cells are blank. This has only been an issue since I updated Xcode. Has anyone run into this issue before? I'm currently using Xcode version 7.1.1
This is a recent bug in interface builder. As a work around, change the size of the view controller in simulated metrics from inferred to freeform and increase the height until a cells render their content.

UITableView rendering differences between iOS 6 and iOS 8

I am in the process of updating an old app from XCode 4.6 to 6.3 and have run into a difference in how my custom table view cells are rendered between iOS 6 and iOS 8 (well the change can be seen in iOS 7 as well).
Here are 2 screen shots from Xcode 4.6/iOS 6.1 simulator:
Here are the equivalent Xcode 6.3/iOS 8.1 simulator:
(As background, the Preferences screen is a grouped UITableView with 3 groups and 1 element per group. The Units screen is a single sectioned UITableView with 3 elements. And the "Note" on the Units image is just a plain view)
The difference I didn't expect (and don't like) is that in iOS 8, the custom table cells have expanded horizontally to cover the entire width of the screen, and have also lost their rounded corners.
I have been looking around to see if/how I can make the iOS 8.1 version look more like the 6.1 version, but so far have failed.
Is it possible to easily get back the layout I want? And if so, where should I be looking to make changes?
One possible approach is to set tableView.backgroundColor and your custom cell's contentView.backgroundColor to clearColor (it can be done via the interface builder as well). Then add a background view to your custom cell. You can give it rounded corners and add space around it.
This is what it looks like at runtime (the blue background belongs to the view behind a tableView):
This is more tricky though when we deal with a group of cells on your right screenshot. There the first cell has to have rounded corners at the top, the last one has to have rounded corners at the bottom, and the middle one shouldn't have rounded corners. I guess, it can be done (you could take indexPath into account when configuring the cell), but it takes a bit more work.
P.S. I'm sorry for the size of images. I don't know how to restrict it.

storyboard bug with UITableView?

This may be me being stupid, but I'll ask the question anyway (at the risk of being down voted to death).
I have a UITableView in a view controller in story board. The size is width=213, height=559. Looks fine in storyboard.
In the ipad simulator (version 6.1) the table has width ~276 and height 559.
I have added no code at all (created a new view controller, dragged in a table, sized it to width213, added a button of width 213 just to have a place marker). Added a button elsewhere in my app that does a model to the new view controller.
I'm using xcode version 4.6.1
Any thoughts?
It seems I don't have any tableviews laid out in a storyboard, but since XCode 4.6.~ I have quite a bit of trouble with the "Autolayout" feature. I would try selecting the problematic table view, then under the file inspector, unselect "Use Autolayout" It seems ON by default now, and causes my .xib's and storyboards not to work as I would expect.

Resources