custom-cell

Adding multiple custom cells in UITableView

两盒软妹~` 提交于 2019-12-04 11:41:34
问题 Though this is one of the most asked question but i could not find one comprehensive answer. I need to have custom cells in UITableView. Some containing labels or text fields and some with images and buttons. I have made separate classes for each type of cell. I am using GroupStyle table with multiple sections. Right now I am adding cells in cellForIndexPath with switch-case for section and if-else for rows in section: id cell; switch(indexPath.section) { case 0: if(indexPath.row==0) { CellA

Can I use a single prototype cell in multiple tableViews?

喜你入骨 提交于 2019-12-04 09:01:27
问题 I am having two different tableviews in two different controller. But the cells, that I need to display in them, look identical. I have created a prototype cell in one tableView and subclassed UiTableViewCell. Now, if I want to use the same cell in a different controller, how can I use it ? If I just import that customCell file in the new controller and deque it using the same identifier given in the storyboard, it wont work. It says Assertion failure in -[UITableView _configureCellForDisplay

Swift Custom Cell creating your own Cell with labels

筅森魡賤 提交于 2019-12-04 05:42:49
I've just started to use Swift as a prorgamming language and i've run into a problem with Custom cells. When i try to create custom cells, and then go forward and try to design them the way i need them ( with Style set to Custom ) everything looks good. Now i don't know how to put specific data into them, since all tutorials i found used the style option "basic" where they only have a text label to which they assign their data. Now for me, when i "control drag" my labels into my code, i give them specific names such as "dateLabel" or "sourceLabel" in order to insert the data correctly. now i'm

How to implement comments and reply system in iOS swift

混江龙づ霸主 提交于 2019-12-03 21:41:13
I have to implement comment and reply system in my application. I am getting the data from the API and I don't understand how to do this cause I have not done anything like this before. I know I have to take two different cells for this type of system but I don't Know how to filter the data for comments and replies and show them in their respective cells. Here is how my JSON: [ { "firstName": "Mark", "lastName": "King", "profilePic": "avatar2 - Copy - Copy.jpg", "reviewId": 54, "userId": 4, "serviceProviderId": 0, "rating": 0, "description": "Thank You...", "isDeleted": false, "parentReviewId"

How do you create a custom prototype cell with master detail view in Xcode?

ぐ巨炮叔叔 提交于 2019-12-03 20:29:50
I created an xcode project with the master detail template. I want to customize the cell to put my data into 2 separate labels. I tried customizing the cell in the storyboard editor, but it seems like all of the stuff on the cell is locked in place. I am fine either creating the custom cell programmatically or in the storyboard editor. I know I could just set the text on the default textLabel to blank and then create the other labels programmatically, but that doesn't seem very need to just have a random empty textLabel in the middle of every cell. So I am wondering if there is a way to edit

iPhone - having selected cell move to top of uitableview

℡╲_俬逩灬. 提交于 2019-12-03 14:29:20
Hey guys, I looked for this problem and I don't believe I could find an answer. I have a tableview of custom cells that when clicked, the selected cell pushes a new cell with information. I was wondering if anyone had an idea of how to push the selected cell to the top of the uitableview, or make it fill up the entire tableview. My uitableview only takes up half of the screen, and I wish for when the cell is selected that it only take up that half of the screen, and the user is still able to scroll the cell (if that makes sense)? Any suggestions would be appreciated, it was somewhat difficult

UITableViewCell in ios7 now has gaps on left and right

久未见 提交于 2019-12-03 11:55:47
I have a UITableView where, in ios6, my custom cell stretched completely to the left and right sides of the screen. So my square image on the left of the cell was hard up against the phone screen. However, now in ios7, there is a small gap appearing on the left hand side so the image is now away from the side and slightly overlaps my text within the cell. This also seems to be happening in other apps I have that I am now viewing in ios7 - all have a gap on the left and perhaps the right as well. My Custom cell is set to a size of 320 according to Interface Builder - ios 7 hasnt changed this

Adding multiple custom cells in UITableView

半腔热情 提交于 2019-12-03 07:13:43
Though this is one of the most asked question but i could not find one comprehensive answer. I need to have custom cells in UITableView. Some containing labels or text fields and some with images and buttons. I have made separate classes for each type of cell. I am using GroupStyle table with multiple sections. Right now I am adding cells in cellForIndexPath with switch-case for section and if-else for rows in section: id cell; switch(indexPath.section) { case 0: if(indexPath.row==0) { CellA *cell = [[[CellA alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:[NSString

How to show 2 customized cells in the UITableView

时光总嘲笑我的痴心妄想 提交于 2019-12-02 20:14:01
问题 I have to show 2 different cells in a table. I have tried it by setting a prototype to a table. but it is still showing Prototype table cells must have reuse identifiers warning. could someone please guide me to resolve this warning. Followed this link: UITableview with more than One Custom Cells with Swift 回答1: In storyboard you have to define the Identifier for the cells like the below image Then in cellForRowAtIndexPath you have to use the specific identifier for specific cell like this

Odd behavior with UITableView in Swift

耗尽温柔 提交于 2019-12-02 15:44:55
问题 I have a custom cell with two labels and a image. I receive some data from internet in Json. Everything works fine; every cell fills with the correspondent data. I've added a new label that has to be filled just like the other ones. This is the data: let cell = tableView.dequeueReusableCellWithIdentifier("friendCell") as! friendCell cell.friendPicture?.image = newImageUser cell.friendName.text = "@\(theName[indexPath.row])" if repliesNumber[indexPath.row] == "0"{ cell.repliesNumber.textColor