开发者

Kind of complicated custom UITableViewCell

开发者 https://www.devze.com 2023-03-13 23:23 出处:网络
I have a particular goal in mind here, searching for it is a little hard.I am trying to accomplish this (This is a photoshopped screenshot):

I have a particular goal in mind here, searching for it is a little hard. I am trying to accomplish this (This is a photoshopped screenshot):

Kind of complicated custom UITableViewCell

I have everything in this view开发者_JAVA百科 working, except for the split row for the Company Name/ Beginning of the field row. The "Company Name" field is just a textfield, all I really want to do is shrink that neato cell background to just go behind the right side.


Create a custom table view cell that has two subviews: the text field on the left and a UITableViewCell on the right as a subview of the main table view cell. A UITableViewCell is just a UIView so you can actually add it as a subview of any view. The main table view cell will have it's background color set to transparent.


So totally complicated custom cell comes with a totally ridiculous solution. I built a view for the cell that has the one field...and another UITableView.

That second UITableView has the "Beginning of the field" text, and its cell gets the background, and I hide the background of the main cell.

I had to play around with the nested table's size and position to get the row to display properly, and make sure that the lines in the background don't shift when it hits the nested table, but it came out perfect


You could try setting the frame property of your cells backgroundView to cover only have your cell's width. Address Book handles complex forms like this with a nice look and feel--you might want to see what they've done there..


One approach would be to define a custom table view cell, set its background transparent and add the UITextField on the left and a UIButton on the right (customize it to look like your other cells), as in your screenshot.

0

精彩评论

暂无评论...
验证码 换一张
取 消