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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:42:53+00:00 2026-06-08T15:42:53+00:00

I have a function called showMessage which displays the alert message dialog. This function

  • 0

I have a function called showMessage which displays the alert message dialog. This function takes string as parameter and shows this string as a message of dialog. At start I wanted the way to pass string and also sting formatter along with it, something like this:

[self showMessageDialog:@"Hello %@", self.studentName];

As you can see what I want to achieve. So I made my function signature something like this:

- (void) showMessageDialog:(NSString *)message, ...{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" 
                                                message:message 
                                               delegate:nil 
                                      cancelButtonTitle:@"OK"
                                      otherButtonTitles:nil];
[alert show];
[alert release];
}

With this I can pass multiple formatters(i mean argument which will go on placeholders) during function call, but I am missing something which doesn’t allow me to show my formatter arguments on message. I mean I always get this message on message dialog: "Hello %@".

I know I have missed something like I have made the way to pass the multiple arguments to function call but I think i haven’t made it how to place those arguments on their placeholders.

Note: I want to make function work like NSLog, way we call NSLog and pass arguments.

  • 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-06-08T15:42:58+00:00Added an answer on June 8, 2026 at 3:42 pm

    What you are trying to do is building a vararg function. Have a look at this tutorial on how to do it.

    Specifically, as far as I understand you will be also be interested in how you can pass your variable argument list from your method to another function taking a variable argument list (say that you want to call sprintf from your showMessageDialog:). This is explained here. Actually, this is easily done (e.g., with NSLog):

    - (void) showMessageDialog:(NSString *)message, ... {
    
        va_list argp;
    
        va_start(argp, msg);
        NSLog(msg, argp);
        va_end(argp);
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function called show which shows a dialog with the message. I
I have this function called ProperCase that takes a string, then converts the first
Now I'm sure this is super easy, I have a function called remove_deposit which
I have a function called block which simply return false; this is meant to
Say I have this repeater which makes use of a public function called Test
In zsh, I have a function called g which acts like this: with no
I have a function called CreateCriteriaExpression that takes a json string and creates a
I have a function called by a thread.this function has a unique argument which
I have a function called ReversedIPAddressString which takes IPAddress as a TCHAR* and then
I have a function called: this.makeStuffHappen() Which makes different animations according to a switch

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.