ios5core-graphicsiphone-sdk-4.1

Setting the Frame of an Object Programatically Has No Effect


I need to me a UIAlertView viewer than the standard size. This is what I'm trying so far:

UIAlertView *addNewDevice = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Add New Device", "Title for add new device") message:nil delegate:self cancelButtonTitle:NSLocalizedString(@"CANCEL", @"Cancel Button") otherButtonTitles:NSLocalizedString(@"OK", "OK"), nil];

addNewDevice.frame = CGRectMake(addNewDevice.frame.origin.x, addNewDevice.frame.origin.y, addNewDevice.frame.size.width, 500);

[addNewDevice show];

Yes I'm aware a width of 500 points is too big, but I merely put that value there to test and my UIAlertView is not modifying its size.

Admittedly I don't know much about dealing with objects programatically, but I have spent the afternoon reading about them with no luck regarding this. Any help will be appreciated.


Solution

  • Try putting the frame line after the show line.

    [addNewDevice show];
    addNewDevice.frame = CGRectMake(addNewDevice.frame.origin.x, addNewDevice.frame.origin.y, addNewDevice.frame.size.width, 500);