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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:51:00+00:00 2026-05-30T07:51:00+00:00

I implemented a UIAlertView that displays a tableView to make a selection and return

  • 0

I implemented a UIAlertView that displays a tableView to make a selection and return to the underlying view controller.

The alert view pops up fine, displays all the data and when I click the cancel button it does not respond, then I click it again and it moves position by quarter of an inch, then when I click it for the third time, the alertView finally disappears.

What would cause this type of behavior?

This is the code:

-(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
CGPoint p = [gestureRecognizer locationInView:self.tableView];

NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:p];
if (indexPath == nil){
    NSLog(@"long press on table view but not on a row");
}
else {
    NSLog(@"long press on table view at row %d", indexPath.row);
    selectedQuote = [self.quotes objectAtIndex:indexPath.row];

    NSLog(@"         subject title = %@", selectedQuote.title);

    // NOW PULL UP THE ADD QUOTE MAP CONTROLLER SO THIS QUOTE CAN BE ADDED TO ANOTHER CATEGORY

    if(aqmController == nil)
        aqmController = [[AddQuoteMapController alloc] initWithNibName:@"AddQuoteMapController" bundle:nil];

    aqmController.selectedQuote = self.selectedQuote;

    //POP UP SBTableAlert

    SBTableAlert *alert;
    alert   = [[SBTableAlert alloc] initWithTitle:@"Categorize this Quote" cancelButtonTitle:@"Cancel" messageFormat:@""];

    [alert setType:SBTableAlertTypeMultipleSelct];
    [alert.view addButtonWithTitle:@"OK"];
    [alert.view setTag:0];
    [alert setStyle:SBTableAlertStyleApple];

    [alert setDelegate:self];
    [alert setDataSource:self];

    [alert show];

}

}

#pragma mark - SBTableAlertDataSource

- (UITableViewCell *)tableAlert:(SBTableAlert *)tableAlert cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell;

cell = [[[SBTableAlertCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];

Category *cat = [categories objectAtIndex:indexPath.section];

Subject *sub = [cat.subjects objectAtIndex:indexPath.row];

cell.textLabel.text =sub.title;   
cell.detailTextLabel.text = sub.category_title;

return cell;

}

- (NSInteger)tableAlert:(SBTableAlert *)tableAlert numberOfRowsInSection:(NSInteger)section {

Category *cat = [categories objectAtIndex:section];
return cat.subjects.count;

}

- (NSInteger)numberOfSectionsInTableAlert:(SBTableAlert *)tableAlert {

QuotesAppDelegate *appDelegate = (QuotesAppDelegate *)[[UIApplication sharedApplication] delegate];
self.categories = [appDelegate categories];

return self.categories.count;

}

- (NSString *)tableAlert:(SBTableAlert *)tableAlert titleForHeaderInSection:(NSInteger)section {

Category *cat = [categories objectAtIndex:section];
NSString *title = [cat category_title];

return title;
}

#pragma mark - SBTableAlertDelegate

- (void)tableAlert:(SBTableAlert *)tableAlert didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

Category *cat = [categories objectAtIndex:indexPath.section];

Subject *sub = [cat.subjects objectAtIndex:indexPath.row];

selectedSubject = sub;
NSLog(@"selectedSubject = %@", selectedSubject.title);

//INSERT INTO QUOTEMAP TABLE

// GET SUBJECT_ID
NSString *stringOfSubjectId = [NSString stringWithFormat:@"%d", selectedSubject.subject_id];

NSLog(@"mySubjectId= %@", stringOfSubjectId);

// GET THE NEXT QUOTE_MAP_ID

QuotesAppDelegate *appDelegate = (QuotesAppDelegate *)[[UIApplication sharedApplication] delegate];
QuoteMap *qm = [[QuoteMap alloc] init];

NSInteger newQuoteMapId = [appDelegate getNextQuoteMapId];
NSLog(@"quote_map_id= %d   subId = %@   quoteId = %@", newQuoteMapId, stringOfSubjectId, selectedQuote.quote_id);

// INSERT INTO QUOTE_MAP TABLE
NSString *stringOfId = [NSString stringWithFormat:@"%d", newQuoteMapId];

qm.quote_map_id = stringOfId;
qm.subject_id   = stringOfSubjectId;
qm.quote_id     = selectedQuote.quote_id;
//qm.isDirty      = YES;

[qm insertQuoteMap:qm];

//Add it to the array.
[qmv.quoteMaps addObject:qm];
[qmv.tableView reloadData];

if (tableAlert.type == SBTableAlertTypeMultipleSelct) {
    UITableViewCell *cell = [tableAlert.tableView cellForRowAtIndexPath:indexPath];
    if (cell.accessoryType == UITableViewCellAccessoryNone)
        [cell setAccessoryType:UITableViewCellAccessoryCheckmark];
    else
        [cell setAccessoryType:UITableViewCellAccessoryNone];

    [tableAlert.tableView deselectRowAtIndexPath:indexPath animated:YES];
}

//release
[qm autorelease];


}

- (void)tableAlert:(SBTableAlert *)tableAlert didDismissWithButtonIndex:(NSInteger)buttonIndex     {
NSLog(@"Dismissed: %i", buttonIndex);

[tableAlert release];
}

- (void)dealloc{

[qmv release];   
[subjects release];
[categories release]; 
[selectedSubject release];

}
  • 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-30T07:51:01+00:00Added an answer on May 30, 2026 at 7:51 am

    Perhaps you should be using SBTableAlertDatasource and SBTableAlertDelegate methods instead of the UITableViewDatasource and UITableviewDelegate methods.

    Also gesture is UILongPressGestureRecognizer. That is a continuous recognizer. You need to check for the state of the recognizer and ignore all the events that come after UIGestureRecognizerStateBegan

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

Sidebar

Related Questions

I implemented a custom list view, but now there's no visual feedback that an
Having implemented CLogClass to make decent logging I also defined macro, but it works
I implemented threading in my application for scraping websites. After all the sites are
In cellForRowAtIndexPath: method I have implemented gesture recognizer for long press, -(UITableViewCell *)tableView:(UITableView *)tableView
I am using an Alert view to bring up a popup where the user
In a class method method I declare the following: UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@Hello
I have controller which implements UIAlertViewDelegate. In implementation I have: - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
I have the main View controller which adds 2 subviews. - (void)viewDidLoad { [self
I'd like to dismiss the whole modal view controller by tapping cancel on the
I implemented a WebPolicyDelegate and the ...decidePolicyForNavigationAction:... method. It works fine, I get among

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.