Any ideas how to show a shadow around the grouped uitableview’s border?(around all border
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
i came up with a rather “hackish” solution to this in my opinion, so i’m not totally happy with it but anyway! the basic functionality of drawing a drop shadow around a group of cells in a section is acomplished by that. therefore i subclassed UITableView and implemented the layoutSubviews method like this:
and a little helper method:
the code is self-explanatory i think!
basically it revolves around adding UIViews to the UITableView as subviews, for a calculated frame of a section, and then drawing the drop shadow to the layer of the added UIView. UITableView provides
some methods for the frame calculations: “rectForSection” etc.
i’m not happy with it because it feels not right adding views in the layoutSubviews method! (this could be done somwhere else => table view delegate?)
i also would have liked more to work with CALayers, but you can’t tag them! because my code works by
shrinking/expanding already added uiviews for performance reasons.
in this form, the solution won’t work if sections disappear or if sections are reorderd etc.
it also behaves not well if you’re adding rows in a animated fashion to the table view etc.
but it’s quite useful for “static” grouped table views i think!
i also haven’t tested for performance implications, so use at own risk!
so maybe this is a good starting point for a possibly better solution to this! 🙂