• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
error details in a NSAlert
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error details in a NSAlert


  • Subject: error details in a NSAlert
  • From: Daniel Luis dos Santos <email@hidden>
  • Date: Sun, 06 Apr 2014 02:19:15 +0100

Hello all,

I want to display some text indicating a list of errors the user should correct before submitting data.

I am using a modal NSAlert in which i set a message with a localised string from a table.
I want to include the error details and for that I was setting the informativeText field but it doesn’t show up unless its a string literal. I need it to be a variable value.

I also tried setting an accessory view but nothing is showed.

The code that uses the accessory view is below.

        NSTextView *accessory = [[NSTextView alloc] initWithFrame:NSMakeRect(0,0,200,15)];
        NSFont *font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
        NSDictionary *textAttributes = [NSDictionary dictionaryWithObject:font forKey:NSFontAttributeName];
        [accessory insertText: informativeText];
        [accessory setEditable:NO];
        [accessory setDrawsBackground:NO];

        NSAlert* errorAlert = [NSAlert alertWithMessageText:NSLocalizedStringFromTable(@"The user data is not valid. Correct it and try again", @"AccountInfoTab", @"The user data is not valid. Correct it and try again") defaultButton:nil alternateButton:nil otherButton:nil informativeTextWithFormat: @""];
        [errorAlert setAccessoryView: accessory];
        [errorAlert runModal];

InformativeText is an NSMutableString.

What I am trying to do is even possible, or am I doing anything wrong ?


_______________________________________________

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


  • Follow-Ups:
    • Re: error details in a NSAlert
      • From: Scott Ribe <email@hidden>
    • Re: error details in a NSAlert
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Autolayoout on scaled views
  • Next by Date: Re: error details in a NSAlert
  • Previous by thread: Re: Autolayoout on scaled views
  • Next by thread: Re: error details in a NSAlert
  • Index(es):
    • Date
    • Thread