I need help to solve this problem I’m trying to get the contents of the asset picker (e.g. Type: Furniture) in the DetailView to show on the ItemsViewContoller. I have created a new UIButton (also tried UILabel) in HomepwnerItemCell called assetLabel to do this. To make room I’m going to remove the serial number from the ItemsView.
So when I pick “Furniture” in the DetailViewContoller.xib, I want to see it in ItemsViewController.xib; the views that is.
Our set up is in DetailViewController and this shows the asset type in viewWillAppear:
NSString *typeLabel = [[item assetType] valueForKey:@“label”];
typeLabel = @“None”;
[assetTypeButton setTitle:[NSString stringWithFormat:@“Type: %@”, typeLabel]
I’ve tried three ways to get this work, but nothing works for me. I believe it should be do-able as the details already show in our DetailView.
- I tried creating a a label in HomepwnerItemCell.xib but found that didn’t work so I set up a UIButton.
I tried passing in the value typeLabel into the cell
[[cell assetTypeLabel] setText:[p typeLabel]];
but the compiler says there is No Visible @interface.
- I then tried using the code from DetailViewController and put this in ItemsViewController but TypeLabel keeps returning “none” and with other adjustments I got “null” as I can’t get it to work with the selected cell “p”, in cellForRowAtIndexPath:
BNRItem *p = [[[BNRItemStore defaultStore] allItems]
HomepwnerItemCell *cell = [tableView dequeueReusableCellWithIdentifier:@“HomepwnerItemCell”];
- I then tried to use viewWithTag to set the field
UILabel *b = (UILabel *)[self.view.window viewWithTag:20];
[cell assetTypeLabel] setText: [NSString stringWithFormat: @"%d", b];
This also doesn’t work for me. I also tried a UIView and UIButtonView version of this as well but nothing worked.
Can someone suggest a solution or a method to solve this? I’m sure there must be an easy way to do this but I can’t see the solution at present.
Thanks in advance