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 3980432
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:17:24+00:00 2026-05-20T05:17:24+00:00

I have a custom view onto which I draw some graphics from the drawrect

  • 0

I have a custom view onto which I draw some graphics from the drawrect function, which works fine.

However I like to draw based on the contens of an array I pass on the the view just before I do a setNeedsDisplay. In the drawRect function If I uses a NSString or NSarray from withing drawRect I get a nested functions error which I do not understand ?

Here’s my code:

//  MyView.h
#import <UIKit/UIKit.h>

@interface MyView : UIView {
 }
@end

//  MyView.m
#import "MyView.h"

@implementation MyView

CGContextRef c;

CGFloat black[4] = {0.0f, 0.0f, 0.0f, 1.0f};

- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // Initialization code
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    c = UIGraphicsGetCurrentContext();

    CGContextSetStrokeColor(c, black);

     //Gives a nested functions are disabled error at compiletime
     NSString nsz * = @"test";      
}

- (void)dealloc {
    [super dealloc];
}

@end
  • 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-20T05:17:25+00:00Added an answer on May 20, 2026 at 5:17 am

    the bottom line is that the “nested function” error is just a “general” error you get when you have a really bad syntax error.

    Such as forgetting to close a bracket. Or a stray operator.

    (Edit — in fact in this case it was a stray ‘ * ‘ operator.)

    It actually has nothing to do with “nested functions” (usually), and, the problem could be almost anywhere in the file or even the previous file.

    Sorry I could not spot the typo!

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

Sidebar

Related Questions

I have an application where I have one custom view which is derived from
I have a custom-made view that extends the View class. I would like 2
I have a GridView in which each row has a custom view. The grid
I have a custom component which consists of 2 text view and 4 toggle
I have a view that I want to add some custom drawing to. I
I have a custom view controller that I push onto my navigation stack as
I have a new gesture, (touch, drag onto other, release) which I would like
I have a custom view to which I need to add a couple of
I have a custom view engine in ASP.NET MVC and since upgrading to RC1
I have a custom control/view that observes the direction of a gesture within its

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.