0

i want to do something like this : i want to prompt an alert view,but inside that alert view i want to add some labels,text fields and star marks[for rating].how can i do that in iOS.i am using iOS 7.and i am really new to this.i did this in my android application. but i don't know how to do that same thing in here.

in my application i am using storyboards.i had an idea about to design a customised view and load it inside alert view. but i do not know weather that can be done or not.please someone help me for this.

thank you.

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
Darshana
  • 314
  • 2
  • 4
  • 22

2 Answers2

1
  • Any CustomView can't be directly added to UIALertView.
  • For alertView there is one property "accesseryView".By Using this we can add any UIView to UIAlertView.

    -(void)customAlertView{

    UIAlertView *Alert = [[UIAlertView alloc] initWithTitle:@"your Title" message:@"Your    
    

    Message" delegate:nil cancelButtonTitle:@"Your Button Title" otherButtonTitles:nil];

    NSArray *subviewArray = [[NSBundle mainBundle] loadNibNamed:@"MyCustomViewOnAlert"  owner:self options:nil];
    MyCustomViewOnAlert *myView = (MyCustomViewOnAlert*) [subviewArray objectAtIndex:0];
    
    [Alert setValue:myView forKey:@"accessoryView"];
    
    [Alert show]; 
    

    }

  • One Custom View "MyCustomViewOnAlert" is created on XIB.

Try This

Jayaprada
  • 944
  • 8
  • 11
  • im really a beginner, so can you tell me that since i am using storyboards is it ok if i am use a different xib for this? this might be a silly question. but i really do not now that. – Darshana Apr 24 '14 at 12:28
  • Yeah .It will work .It will not affect your storyBorad.Try this and let me know if you are getting anything wrong .Gud Luck – Jayaprada Apr 24 '14 at 12:36
0

If you need library prompting user to rate your app in the App Store use this library https://github.com/nicklockwood/iRate