For your first question, set the target to "self" and the selector to the name of the method you wish to call that will display the alertView - maybe something like "showShareAlert" which could be coded as ...
Code:
-(void)showShareAlert {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Title" message:@"AThe message." delegate:self cancelButtonTitle:@"button 1" otherButtonTitles: @"Facebook", @"Twitter", @"Email", nil];
[alert show];
[alert release];
}
Then you'll need a method to handle the response, something like:
Code:
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
// the user clicked one of the buttons
switch (buttonIndex){
case 0:
// handle a cancel event
break;
case 1:
//handle a facebook share
break;
case 2:
//handle twitter
break;
case 3:
//handle email
break;
default:
//do whatever
break;
}
}
be sure that your header file includes the AlertViewDelegate protocol declaration like this:
Code:
@interface aViewController : UIViewController <UIAlertViewDelegate>
You're on your own on the specifics of Facebook and Twitter. Sorry.