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

  • SEARCH
  • Home
  • 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 7495861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T18:21:53+00:00 2026-05-29T18:21:53+00:00

I have a UIAlertView with an image and a large button. The problem is

  • 0

I have a UIAlertView with an image and a large button.

The problem is that the default UIAlertView is a very small size. It’s image cannot be seen properly.

So, I want to increase the height and width of the UIAlertView. In other words, I want to create a custom UIAlertView. What would be the way to do that?

Thanks.

  • 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-29T18:21:54+00:00Added an answer on May 29, 2026 at 6:21 pm

    I am sending you my code, I am showing a TableView in AlertView, perhaps it will help you.

    in header file paste this code.

    #import <UIKit/UIKit.h>
    
    @interface aaViewController : UIViewController <UIAlertViewDelegate, UITableViewDelegate, UITableViewDataSource>{
    
        UITextField *textfield;
        UITableView *tableView1;
    
        NSMutableArray *_data;
    }
    
    @property (nonatomic, retain) NSMutableArray *_data;
    
    - (void) showAlertView;
    - (void) doAlertViewWithTextView;
    - (void) doAlertViewWithTableView;
    @end
    

    and in your imlpementation(.m) file paste this code.

    #import "aaViewController.h"
    
    @implementation aaViewController
    
    @synthesize _data;
    
    
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad {
        [super viewDidLoad];
    
        self._data = [NSMutableArray arrayWithObjects:@"Najeeb", @"Furqan", @"Khalid", nil];
        [self doAlertViewWithTableView];
    }
    
    // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return YES;
    }
    
    - (void)didReceiveMemoryWarning {
        // Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
    
        // Release any cached data, images, etc that aren't in use.
    }
    
    - (void)viewDidUnload {
        // Release any retained subviews of the main view.
        // e.g. self.myOutlet = nil;
    }
    
    
    - (void)dealloc {
        [super dealloc];
    }
    
    - (void) doAlertViewWithTextView {
    
        UIAlertView *alert = [[UIAlertView alloc] initWithFrame:CGRectMake(0, 0, 300, 550)];
    
        alert.title = @"Textview";
        alert.message = @"I am doing cool stuff\n\n\n";
        alert.delegate = self;
        [alert addButtonWithTitle:@"Cancel"];
        [alert addButtonWithTitle:@"OK"];
    
        UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(12, 90, 260, 200)];
        textView.text = @"This is what i am trying to add in alertView.\nHappy New Year Farmers! The new Winter Fantasy Limited Edition Items have arrived! Enchant your orchard with a Icy Peach Tree, and be the first farmer among your friends to have the Frosty Fairy Horse. Don't forget that the Mystery Game has been refreshed with a new Winter Fantasy Animal theme! ";
        textView.keyboardAppearance = UIKeyboardAppearanceAlert;
    
        [alert addSubview:textView];
        [textView release];
    
        [alert show];
        [alert release];
    }
    
    - (void) doAlertViewWithTableView {
    
        NSLog(@"Now play with TableView \n%@", self._data);
    
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Table View" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
    
        tableView1 = [[[UITableView alloc] initWithFrame:CGRectMake(10, 40, 264, 200) style:UITableViewStyleGrouped] autorelease];
        tableView1.dataSource = self;
        tableView1.delegate = self;
        [alert addSubview:tableView1];
    
        [alert show];
        [alert release];
    }
    
    //#define kTag_EnterNameAlert  1
    //#define kTag_NameEmtryField  100
    - (void) showAlertView {
    
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Congratulations!"
                                                        message:@"You earned a top score! Enter your name:\n\n"
                                                       delegate:self 
                                              cancelButtonTitle:nil
                                              otherButtonTitles:@"OK", nil];
    
        //alert.tag = kTag_EnterNameAlert;
    
        CGRect entryFieldRect = CGRectZero;
        if( UIDeviceOrientationIsPortrait( [UIApplication sharedApplication].statusBarOrientation ) ) {
            entryFieldRect = CGRectMake(12, 90, 260, 25);
        }
        else {
            entryFieldRect = CGRectMake(12, 72, 260, 25);
        }
        textfield = [[UITextField alloc] initWithFrame:entryFieldRect];
        //textfield.tag = kTag_NameEmtryField;
        textfield.backgroundColor = [UIColor whiteColor];
        textfield.keyboardType = UIKeyboardTypeAlphabet;
        textfield.keyboardAppearance = UIKeyboardAppearanceAlert;
        textfield.autocorrectionType = UITextAutocorrectionTypeNo;
        textfield.clearButtonMode = UITextFieldViewModeWhileEditing;
        [alert addSubview:textfield];
        [textfield becomeFirstResponder];
        [textfield release];
    
        [alert show];
        [alert release];
    }
    
    # pragma -
    # pragma alertView frame Methods
    
    - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
    
        NSLog(@"name:%@   buttonID:%d",textfield.text,buttonIndex);
        if (buttonIndex == 1) {
            [self doAlertViewWithWebView];
        }
        else {
            NSLog(@"%@",alertView.message);
        }
    }
    
    // to set the alertView frame size.
    - (void)willPresentAlertView:(UIAlertView *)alertView {
    
        [alertView setFrame:CGRectMake(10, 100, 300, 320)];
        for ( UIView *views in [alertView subviews]) {
            NSLog(@"%@",views);
            if (views.tag == 1 || views.tag == 2) {
                [views setFrame:CGRectMake(views.frame.origin.x, views.frame.origin.y+200, views.frame.size.width, views.frame.size.height)];
            }
        }
    }
    
    # pragma -
    #pragma mark TableView Methods
    
    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
        return 2;
    }
    
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
        if (section == 1) {
            return [_data count];
        }
        else
        return 3;
    }
    
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
        static NSString* const SwitchCellID = @"SwitchCell";
        UITableViewCell* aCell = [tableView dequeueReusableCellWithIdentifier:SwitchCellID];
        if( aCell == nil ) {
            aCell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:SwitchCellID] autorelease];
            aCell.textLabel.text = [NSString stringWithFormat:@"Option %d", [indexPath row] + 1];
            aCell.selectionStyle = UITableViewCellSelectionStyleNone;
            UISwitch *switchView = [[UISwitch alloc] initWithFrame:CGRectZero];
            switchView.tag = [indexPath row]+1;
            aCell.accessoryView = switchView;
            [switchView setOn:YES animated:NO];
            [switchView addTarget:self action:@selector(soundSwitched:) forControlEvents:UIControlEventValueChanged];
            [switchView release];
        }
    
        return aCell;
    }
    
    - (void) soundSwitched:(UISwitch*) switchView {
    
        if (!switchView.on) {
            NSLog(@"chal bhag %d", switchView.tag);
        }
    }
    
    @end
    

    Note: In your AppDelegate add as subView to this.

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

Sidebar

Related Questions

I have a UIAlertView that asks a user whether they want to copy a
I have a UIAlertView with several buttons. I want to make a certain button
I want to have a UIScrollView that is inside of my UIAlertView . Code
Essentially I have a UIAlertView that pops up. When a user selects a button
I have a method that posts HTTP data and displays a UIAlertView if there
I have made a custom UINavigationController class so that I can have a UIAlertView
Everybody, I need to set one image on UIAlertView.. I have attached my UIAlertview
I want a UIAlertView to popup if the user doesn't have enough points to
I already have a custom UIAlertView and in which i want to add UIImageView
I have two UIAlertView s in same view controller and I want to use

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.