i am using UItable view to show data. i have UIbutton in each cell on right side.when i select edit mode in table my UIButton displays outside from table.please tell me what should i do.
krishan
Use either autoresizingMask in code or the Size Inspector in IB to change the behavior to what you want, depending on how you created your button (code or IB). You can tell it to keep the left margin at a constant size, or change the width, or whatever you decide looks best.
Related
In xib table is having 1 rows
Dynamically as the app progresses in table from code there are 3 rows.
In table view I have button in cell on whole click I need to show one pop up view and set its frame according to cell frame
On the click I set frame of that pop up view
As soon as the pop up view's frame is set the view is seen as it is seen in xib
that is now instead of 3 rows there is only 1 row as in xib
These all happens when I set auto layout to true
If I set auto layout false there is no problem
I am not writing code as there is no code except I set frame with CGRECT
got it
in viewDidLoad I wrote
self.tblTemp.translatesAutoresizingMaskIntoConstraints = YES;
so now my table does not change frame.
In the scenario above I used autolayout in the view as I used the constraints for other controls, but I did not want to use for these particular table.
I did not use any constraints for table view, as I needed to change its frame dynamically.
so I put the above line
Previously table was automatically changing the frame to the one set in xib, on changing any particular frame(I need to show or hide pop up view on some cell button click, so I just set frame there)
I think here apple is translating my auto resizing constraints to auto layout ones. I am not still not sure how it is working. I read some where in apple guidelines about translatesAutoresizingMaskIntoConstraints, as actually by default it is YES.
If anyone finds useful
I'm working on a UITable with allowsMultipleSelectionDuringEditing = true, then I get a circle and red checkmark in the table when it is editing:
The problem is, I need to customize the table view cell such that there are some background image for the cell, and I need a larger margin in the left side of the cell. I can customize the cell contentView for the content position, but are there a way I can customize the checkmark and circle position?
I could have implement a customize table view cell with my own multi selection logic and view, but are there a way I can do it with the built-in multi-select implementation? If not, would you recommend a idiomatic way to do it?
it is possible to change the position of the check mark,
Please make a Table View cell XIB and give it a background image and check mark image and a label ..
the hiding and the display of the check mark will be managed by the associated class of XIB.
it will work for you.
** All the best
To answer my own question, you cannot move the red checkmark and circle (editing control) with public API.
You can however, override the UITableViewCell layoutSubviews method. Inside it find the subview which is a "UITableViewCellEditControl", and modify its position as you wish.
for some reason the label in my uitableviewcell changes position when I have an activity indicator or something like that load on the right.. is there anyway to stop this?
cell one is having the problem in this view
Cell one and two are having the issue in this view
what happens is that when I have something loading in the background I have a uiactivity indicator, once thats played the labels in my custom cells move over to the right. if there is no Disclosure Indicator then you will see in the second image cell two moves right over to the right.. but if there is a Disclosure Indicator it moves over only a little bit.. other wise the labels will load in the correct position, but as soon as some type of cell indicatory happens then it throws the labels out of alignment.
Check your label's autoresizingMask includes UIViewAutoresizingFlexibleLeftMargin. If you're creating cells from storyboard/nib file, go to XCode's Size Inspector view and change the Autosizing to look like this:
Is there a way to hide the overflow in a UITableViewCell? I have a custom cell view, that I load into the table, where some of the information is supposed to be hidden on load, and then each row will expand when clicked.
Right now, I'm returning height 30 for my row, which is the height of the cell header, but the buttons and text that are supposed to be hidden just overflows and is placed on top of the headers below.
While you can use clip subviews(cell.contentView.clipsToBounds = YES), it's probably best if you add the subviews when you need to expand and remove the subviews the cell collapses. It should increase performance.
There's a property on UIView "clips subviews?".
If you set this value TRUE for the cells, it should stop the buttons from overflowing - you can do it either in IB, or in code programmatically (slightly different name in code).
HOWEVER ... this may NOT be what you want. Depends on the effect. Last time I did what you're doing, I used clipsubviews.
Usually, the correct way to hide your buttons etc is the UIView property "hidden" (or the other one - "enabled").
But that might mess with your animations - depends how you're animating the click-to-expand.
I have a UITableView as a subview in a ScrollView with other widgets around like a button. I'd like to put the button always at the end of the ScrollView and I'd like to have the UITableView to show dynamically more section. How and where shall I determine the Table size, correctly set it and visualize it?
From Interface Builder it seems that I can only set static size to the TableView (which of course limits the number of sections visible) and stick the button position to the bottom whether a rotation happens.
If you have only few simple controls after the table then I'd suggest putting them to the table itself and get rid of the unhealthy (in my opinion) combination of table view inside scroll view.
You might add the button you are talking about to the table's footer.
It may be done in the Interface Builder (drag-n-drop the button to the bottom of the table view) or in the code ([tableView setTableFooterView:myButton];).
If your button should be smaller that table's width then put it inside UIView and locate as you need.
You can also add table header in a similar way...