Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6969481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:35:11+00:00 2026-05-27T16:35:11+00:00

I am setting the font property of a label using the fontWithSize: method and

  • 0

I am setting the font property of a label using the fontWithSize: method and while it works fine in iOS 5, iOS 4.3 I am getting an exc_bad_access error. Here is my code:

UILabel *headerText = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, tableView.bounds.size.width - 10, 42)];

headerText.text = [tableView.dataSource tableView:tableView titleForHeaderInSection:section];


headerText.font = [[UIFont alloc] fontWithSize:8];

Again, this code works perfectly in iOS 5, but crashes as the last line in 4.3. I checked the Apple API docs and fontWithSize: as well as the font property of a UILabel have both been around since iOS 2. Is there anything else wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:35:12+00:00Added an answer on May 27, 2026 at 4:35 pm

    If you use alloc to initial, the method usually begins with init.

    fontWithSize : is not used to initial.

    Returns a font object that is the same as the receiver but which has the specified size instead.

    It means that you should call it using an existing font instance.
    For example:

    
        UIFont *font = [UIFont systemFontOfSize:12];
        UIFont *newFont = [font fontWithSize:24];
    

    But if you want to initial an instance, you need call the class method or instance method beginning with init.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using UINavigationItem's titleView property to set a custom UILabel with my desired font
When drawing strings using drawAtPoint:, drawInRect: and even setting the text property of UILabels
I'm programmatically sending HTML-formatted email, and setting the font as Arial throughout ( font-family:
My boss is running a laptop which has a setting which is resizing font
Setting up an integration server, I’m in doubt about the best approach regarding using
Setting onchange event for CheckBoxList using the following code doesn't work. chkListUserGroup.Attributes.Add(onchange, document.forms[0].isRecordModified.value='true';); How
It is necessary to switch off the ClearType property of the default font for
Despite setting the labelRotation property to 90 in this column chart, the axis labels
I wrote up some small macros to help in setting application-wide font styles, colors
I have an app where I am setting the font for a UILabel programmatically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.