Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use OHAttributedLabel in Custom table view cell label #156

Open
ahadnawaz opened this issue Sep 16, 2013 · 1 comment
Open

Unable to use OHAttributedLabel in Custom table view cell label #156

ahadnawaz opened this issue Sep 16, 2013 · 1 comment
Labels

Comments

@ahadnawaz
Copy link

I do have custom cell having UILabels one for text and second for translation. I want to assign attributed text to that translation label without allocating in cellForRowAtindexPath. Is there any option to do some thing like this

import <UIKit/UIKit.h>

#import <OHAttributedLabel/OHAttributedLabel.h>

@interface SelectedSurahCell : UITableViewCell
@Property (strong, nonatomic) IBOutlet OHAttributedLabel *aayat;
@Property (strong, nonatomic) IBOutlet UILabel *translation;

@EnD

and table view controller I want to do

cell.aayat = (OHAttributedLabel*)[cell.aayat viewWithTag:kAttributedLabelTag];
cell.aayat.frame = CGRectMake(0, 0, 275, height);
[cell.aayat setAttributedText: [ self AttributedString: ayatText ] ];

its doesn't set text to custom cell

Please give me any suggestion. Thanks in advance

@AliSoftware
Copy link
Owner

  • Did you add aayat as a subview to your cell?
  • More important question : do you have the same issue if you use an UILabel or is it specific to OHAttributedLabel
  • Last but not least: is height high enough to display at least a whole line of text (especially, CoreText — which OHAttributedLabel uses to draw attributed strings — does not draw a line at all if there isn't enough height to draw it whole, contrary to UIKit which draws it partially)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants