开发者

Grouped table with image in first row (and section), the remaining ones having text with different length

开发者 https://www.devze.com 2023-01-03 11:54 出处:网络
I have a grouped table with two sections where I display text with different length and therefore cell height.

I have a grouped table with two sections where I display text with different length and therefore cell height.

I have solved the problem with the different length/height with constrainedToSize in cellForRowAtIndexPath.

Now I want to add a section with one single row in which I want to show a picture.

How should I best implement that? (still a bit of a beginner with the Objective C)

I would guess that I would have to create an UIImageView and somehow link that to the cell, but my biggest concern is how do I开发者_开发问答 do with the dequeueReusableCellWithIdentifier now that I will have two different type of cells?

Appreciate any advice that will help me save time from trial and error!


I ended up doing this:

Since my image is in my first section (and nothing else in that section) I divided my cellForRowAtIndexPath in to two parts with a simple if statement. One for the first section and one for the rest. Then I use two different dequeueReusableCellWithIdentifier and can set up two kind of cells. So far it work fine.

0

精彩评论

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