From susan.cudmore at gmail.com Wed Aug 28 14:20:59 2013 From: susan.cudmore at gmail.com (Susan Cudmore) Date: Wed, 28 Aug 2013 14:20:59 -0400 Subject: Custom UICollectionViewCell question. Message-ID: Hi All, I'm trying to use a custom UICollectionViewCell that has a top level view with subviews including an imageview, and several labels that I need to set when the cell is loaded. I am using storyboards and creating the aforementioned views in the cell that shows up when I drag in a UICollectionView. I believe the identifiers are set correctly and I am registering the cell with the UICollectionView obj in viewDidLoad. I have also hooked up Outlets (at least it appears so to me) in my UICollectionViewCell for each of the properties that I wish to set at run time. I'm trying to dequeue my custom cell using its identifier in cellForIndexPath. I see that the initWithFrame method gets called on my custom UICollectionViewCell. It seems that unless I set the frame on all of the views and programmatically add them to the contentView of the UICollectionViewCell, the views don't show up. At that point, why am I bothering to put any of these views in IB? Any idea what I might be missing? Would I be better off creating a nib and loading the cell from a nib rather than have it embedded in the UICollectionView in the storyboard? Thanks for any pointers! /Sue -------------- next part -------------- An HTML attachment was scrubbed... URL: From susan.cudmore at gmail.com Wed Aug 28 17:04:41 2013 From: susan.cudmore at gmail.com (Susan Cudmore) Date: Wed, 28 Aug 2013 17:04:41 -0400 Subject: Custom UICollectionViewCell question. In-Reply-To: References: Message-ID: Before anyone else spends cycles thinking about this... problem solved. Thanks T.J.! I was setting the cell identifier in the storyboard and then also registering it programatically. Oy! On Wed, Aug 28, 2013 at 2:20 PM, Susan Cudmore wrote: > Hi All, > > I'm trying to use a custom UICollectionViewCell that has a top level view > with subviews including an imageview, and several labels that I need to set > when the cell is loaded. I am using storyboards and creating the > aforementioned views in the cell that shows up when I drag in a > UICollectionView. I believe the identifiers are set correctly and I am > registering the cell with the UICollectionView obj in viewDidLoad. I have > also hooked up Outlets (at least it appears so to me) in my > UICollectionViewCell for each of the properties that I wish to set at run > time. > > I'm trying to dequeue my custom cell using its identifier in > cellForIndexPath. I see that the initWithFrame method gets called on my > custom UICollectionViewCell. It seems that unless I set the frame on all of > the views and programmatically add them to the contentView of the > UICollectionViewCell, the views don't show up. At that point, why am I > bothering to put any of these views in IB? > > Any idea what I might be missing? Would I be better off creating a nib and > loading the cell from a nib rather than have it embedded in the > UICollectionView in the storyboard? > > Thanks for any pointers! > > /Sue > -------------- next part -------------- An HTML attachment was scrubbed... URL: From griotspeak at gmail.com Wed Aug 28 15:24:26 2013 From: griotspeak at gmail.com (T.J. Usiyan) Date: Wed, 28 Aug 2013 15:24:26 -0400 Subject: Custom UICollectionViewCell question. In-Reply-To: References: Message-ID: Hello Susan, What layout are you using and are you returning any attributes for the cells? Have you set the identifier in the nib? TJ On Wed, Aug 28, 2013 at 2:20 PM, Susan Cudmore wrote: > Hi All, > > I'm trying to use a custom UICollectionViewCell that has a top level view > with subviews including an imageview, and several labels that I need to set > when the cell is loaded. I am using storyboards and creating the > aforementioned views in the cell that shows up when I drag in a > UICollectionView. I believe the identifiers are set correctly and I am > registering the cell with the UICollectionView obj in viewDidLoad. I have > also hooked up Outlets (at least it appears so to me) in my > UICollectionViewCell for each of the properties that I wish to set at run > time. > > I'm trying to dequeue my custom cell using its identifier in > cellForIndexPath. I see that the initWithFrame method gets called on my > custom UICollectionViewCell. It seems that unless I set the frame on all of > the views and programmatically add them to the contentView of the > UICollectionViewCell, the views don't show up. At that point, why am I > bothering to put any of these views in IB? > > Any idea what I might be missing? Would I be better off creating a nib and > loading the cell from a nib rather than have it embedded in the > UICollectionView in the storyboard? > > Thanks for any pointers! > > /Sue > > _______________________________________________ > MacTechGroup-discuss mailing list > MacTechGroup-discuss at lists.mactechgroup.org > http://lists.mactechgroup.org/mailman/listinfo/mactechgroup-discuss > > -------------- next part -------------- An HTML attachment was scrubbed... URL: