UILabel changing position - iphone

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:

Related

drag and drop from uitableviewcell to uiimage view in ios

I need help implementing a drag and drop gesture, I would like to know Your opinion to find the best approach.
I have a view controller with a uitableview on the right and some image views on the left.
I would like to allow the user to drag every cell of the table view on one of the image views. Basically the drag-n-drop will fail if the cell is not released on one of the image views, otherwise the image view will change image according to the dropped cell.
What do You think is the best way to achieve this?
In addition, when the user start dragging, I would like that he drags around a particular shaped subview, with image and data, not drag the semitransparent cell.
Thanks,
The basic steps for this would be:
Add a long press gesture recognizer to your table view (the whole view, not individual cells)
When the gesture begins, find which cell it is over (convert point, then user indexPathForRowAtPoint to get the cell)
Make a copy of that cell which will become the dragged view (take a snapshot, add it to a UIImageView and add that to your main view). Or you could make the view look however you want if you dont want it to look like the cell
make your original cell hidden so it looks like it is being dragged
On gesture changed, move teh position of this image view based on locationInView of the gesture)
On gesture ended, check to see if the cell is over an image (hitTest: for this) and do any animations or calculations you need.

UITableView Grouped table border issue

I am creating a grouped table with two sections.In the first section i have 5 cells and in the second section i have two buttons in the lass cell of it.
I have created labels and buttons on each of the cells in the first section and the labels are populated dynamically by the values selected in the previous screen.
Everything works fine as expected,except the borders of the table view gets ruined,it looks like half drawn and incomplete.When i make the table view to scroll up and when its back in the original position,the top borders are spoiled and when i scroll to the bottom the lower borders of the group gets affected making them incomplete.
I am setting the label's and button's attributes in each of cell after initializing them in the viewDidLoad method.
Please suggest me an idea to solve this issue.
Thank you one and all
I am setting the label's and button's attributes in each of cell after
initializing them in the viewDidLoad method.
This is incorrect. You should save the texts for the labels & buttons in a model class & set them in the cellForRowAtIndexPath: method. As, you are not doing this in the aforementioned method, your cell is redrawn when you scroll and the texts are nullified.

Why is my UITableView getting its images messed up?

I'm trying to get my UITableView to show cells with images placed on them (contained in a UIImageView overlaid). I'm wondering why when scrolling up and down, the images look like they're overlaid on top of one another.
What can I do in this case for the sake of memory management as well as to fix this issue?
Make sure that when you're dequeuing a reusable cell that you remove whatever image view was in the cell before you add the one for the current index path.
Alternatively, you can change the image property of the UIImageView.

Is it possible to expand the table view's cell at run time?

I am developing an iphone application .
In which i want to show some detailing by the means of expansion of that cell (i.e. by the means of touching the cell it should animate and exapnd and show the details) and in that show the details related to selected row.
What you could do is:
cell is tapped, do a transform on the cell's view to expand it. Fade it out while fading in a new fullscreen view that has some similarity but has the extra data you want displayed. When you are done with that view, shrink it while fading out and fade in the cell view again.
have to update the height of the cell.....

Tweetie like swipe menu

How can I implement tweetie like swipe menu?
I'm done with developing a tableviewcontroller with a customcell. The customcell implements touchesbegan and touchesMoved. It also reports swipe gestures via a selector to the parent tableviewcontroller.
Now how should I go about hiding the "Swiped" cell and replacing it with a "swipe menu view" and how should I get the actions from the buttons present on the swipeview?
Each table view cell has a contentView that encompasses the whole area of the cell. Add your swipe-menu view as a single container view with an opaque background to the contentview so it's on top of everything else. Position it so it's flush left (x=0), set the width to 0, and set it as hidden. That single container can include any other subview (buttons, etc) and you can set the cell view itself as the target of the button events (then bubble it up to the parent table view along with cell index information).
When time comes to show it, set it to not hidden then use UIView animation to make the container width go from 0 to full table width. Set the duration pretty low (i.e. 0.2 seconds) so it's zippy. When you run the animation, the swipe-menu shows up over everything else in the cell content view. To make it disappear just reverse it (set the width to 0 in a UIView BeginAnimation block). You may also want to set an animation completion handler at the end and do some housekeeping there (set the container view to hidden, release memory, etc).
I've done a tweetie like menu, there's no full code but i blogged about it. Hope it helps!
http://petersteinberger.com/2010/01/tweetie-like-swipe-menu-for-iphone-apps/