Re: UI_APPEARANCE_SELECTOR question
Re: UI_APPEARANCE_SELECTOR question
- Subject: Re: UI_APPEARANCE_SELECTOR question
- From: Alex Kac <email@hidden>
- Date: Thu, 14 Feb 2013 12:37:34 -0700
OK I think I figured it out. There are several layout calls to the UITableViewCell (the parent view controller is doing a reload on certain rows on a data change), and those first 2 or so layout calls the appearance proxy is nil, but on the third its there and gives me the correct info. I had some bad logic in my code that just made the first 2 calls set other variables it shouldn't have.
So I've found/fixed my issue.
On Feb 14, 2013, at 11:06 AM, Alex Kac <email@hidden> wrote:
> One more question I hope. I've got the below working great, so I started using it in other places within my code - specifically for some sub-classed UITableViewCells:
>
> //appearance settings
> @property (nonatomic, assign) NSInteger showDateLabel UI_APPEARANCE_SELECTOR;
> @property (nonatomic, assign) NSInteger showPillView UI_APPEARANCE_SELECTOR;
>
> I'm using it in - (void)layoutSubviews and all seems fine - they are set to 1 when I load the cells in the table view. However when I push a controller onto the stack and then pop it back, the table cells now within the layoutSubViews show the properties as 0. I've double checked everywhere and I'm not setting these properties anywhere except in the appearance proxy.
>
> I'm sure there are some assumptions I'm making that may not be correct, but any help would be appreciated.
>
> On Feb 8, 2013, at 2:42 PM, Luke the Hiesterman <email@hidden> wrote:
>
>> Appearance customizations get applied at layout time, so your view simply hasn't had the appearance applied yet in -initWithFrame:. That's why self.tabFont is nil.
>>
>> Luke
>>
>> On Feb 8, 2013, at 1:38 PM, Alex Kac <email@hidden>
>> wrote:
>>
>>> Trying to see if I understand this correctly and what I may be doing wrong. I have a tab bar project that is in my workspace and I've added this to its font property: UI_APPEARANCE_SELECTOR as such:
>>>
>>> @interface AKTabBarButton : UIView {
>>>
>>> }
>>>
>>> @property (nonatomic, strong) UIFont *tabFont UI_APPEARANCE_SELECTOR;
>>>
>>> - (id)initWithTabBarItem:(AKTabBarItem*)item;
>>> @end
>>>
>>>
>>> Within the initWithFrame: method:
>>>
>>> label.font = self.tabFont ? self.tabFont : [UIFont boldSystemFontOfSize:10];
>>>
>>> and in code before we ever create any tab bars:
>>>
>>> [[AKTabBarButton appearance] setTabFont:[UIFont boldSystemFontOfSize:12]];
>>>
>>> However self.tabFont is always nil. Its never getting my customized font. All the articles/websites/devforum pages I've read say that this is all I should have to do, but as something that's not documented much I'm not seeing how its supposed to work.
>>>
>>> I'd love any tips or pointers on what I'm doing wrong.
Alex Kac - President and Founder
Web Information Solutions, Inc.
"To educate a person in mind and not in morals is to educate a menace to society."
-- Theodore Roosevelt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden