Search Results

Search found 58 results on 3 pages for 'uiactionsheet'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • UIActionSheet cancel button strange behaviour

    - by nevan
    I have a UIBarButtonItem opening an action sheet to offer users choices about what to do. Everything works as expected unless I try to click on the "Cancel" button. The target of the button appears to have moved up from where it should be. I can only activate it by clicking somewhere in the middle of the "Cancel" and "Ok" buttons. I've tried at action sheets in other applications and they work fine, so it's not just my big thumb. The action sheet is opening in a UIViewController - (void)showOpenOptions { UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:NSLocalizedString(@"Open link in external application?", @"Open in external application") delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel") destructiveButtonTitle:NSLocalizedString(@"Open Link", @"Open Link") otherButtonTitles:nil]; [sheet showInView:self.view]; [sheet release]; }

    Read the article

  • UIActionsSheet text shadow problem

    - by AlexVogel
    I have a problem with the text shadow of the UIActionSheet buttons. At iOS 4.0.2 long string were truncated automatically. No at iOS 4.2 these texts are presented with a smaller font. But now the offset of the shadow is corrupted and to big. Is there a possibility to change/remove the text shadow of the UIActionSheet. EDIT: I'm building the UIActionSheet not with initWithTitle:, but with the normal init and sets all needed properties afterwards because the number of possible buttons is dynamic and the texts cannot be change. I've tested it with initWithTitle: and got the same results.

    Read the article

  • iPad: Displaying UIActionSheet with UIPickerView as subview

    - by E-Madd
    I'm in the process of migrating an iPhone app to a universal app. On one of my views, I present a UIActionSheet with a UIPickerView as a subview. On the iPhone this always worked just fine. Of course, on the iPad I had to change a little to present the ActionSheet in a popover control. Here's some psuedo-code to outline where I'm at... actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,44,0,0)]; pickerView.delegate = self; pickerView.dataSource = self; pickerView.showsSelectionIndicator = YES; [actionSheet addSubview:pickerView]; if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad){ [actionSheet showInView:self.view]; [actionSheet setBounds:actRect]; }else{ [actionSheet showFromRect:buttonRect inView:[UIApplication sharedApplication].keyWindow animated:YES]; } The resulting popover on the iPad is very small and only the very top of the UIPickerView is visible. How can I set the size of the popover?

    Read the article

  • Action sheet doesn't show Cancel button on iPad

    - by Padawan
    On the iphone, this code shows the cancel button: - (IBAction)buttonPressed { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Are you sure?" delegate:self cancelButtonTitle:@"No way!" destructiveButtonTitle:@"Yes, I'm sure!" otherButtonTitles:nil]; [actionSheet showInView:self.view]; [actionSheet release]; } But on the iPad, only the destructive button shows. What's the problem?

    Read the article

  • UIAlertController handle dismiss upon click outside (IPad)

    - by Tomer Peled
    Previous to iOS8 we used the UIActionSheet for showing alert and now we need to use the UIAlertController. When we used the UIActionSheet we could easily handle situations where the user clicked outside the pop up (which means he want to cancel the operation) by comparing the clickedButtonAtIndex to the cancelButtonIndex - if the user indeed pressed outside the popup we got the cancel button index in this function. How can we handle these situations with the new UIAlertController? I tried to use the "completion" block but it doesn't have any context. Is there an easy way to handle this? (other than "saving" the actions states in some general variable).

    Read the article

  • Strange problem in Action sheet when click the Cancel Button in iphone

    - by Pugal Devan
    Hi, I have used action sheet in my view. Now i have faced one strange problem. If i clicked the cancel button, it dismissal the action sheet. But i clicked the cancel button, it works only Half part of the button(upper side only). Other part i clicked it doesnt work. (Half portion of the button only works. Eg: actionsheet size 320X40. clicking works only 320X20. Other part doesnt work). I have already used action sheet in many applcations. But i donno what i m doing wrong?. Please find me the problem where it is? See my code is, I have declared also UIActionsheetDelegate in interface class. - (void)viewDidLoad { UIBarButtonItem *addButton = [[[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Share", @"") style:UIBarButtonItemStyleBordered target:self action:@selector(popupActionSheet)] autorelease]; self.navigationItem.rightBarButtonItem = addButton; } -(void)popupActionSheet { UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:@"Share Post" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Email",@"Facebook",@"Twitter",nil]; popupQuery.actionSheetStyle = UIActionSheetStyleDefault; [popupQuery showInView:self.view]; [popupQuery release]; } Please help me out. Thanks.

    Read the article

  • How does the overall view hierarchy change when using UIKit view manipulations?

    - by executor21
    I've been trying to figure out what happens in the view hierarchy when methods like pushViewController:animated, presentModalViewController:animated, and tab switches in UITabBarViewController are used, as well as UIAlertView and UIActionSheet. (Side note: I'm doing this because I need to know whether a specific UIView of my creation is visible on screen when I do not know anything about how it or its superview may have been added to the view hierarchy. If someone knows a good way to determine this, I'd welcome the knowledge.) To figure it out, I've been logging out the hierarchy of [[UIApplication sharedApplication] keyWindow] subviews in different circumstances. Is the following correct: When a new viewController is pushed onto the stack of a UINavigationController, the old viewController's view is no longer in the view hierarchy. That is, only the top view controller's view is a subview of UINavigationController's view (according to logs, it's actually several private classes such as UILayoutContainerView). Are the views of view controllers below the top controller of the stack actually removed from the window? A very similar thing happens when a new viewController is presented via presentModalViewController:animated. The new viewController's view is the only subview of the kew window. Is this correct? The easiest thing to understand: a UIAlertView creates its own window and makes it key. The strangest thing I encountered: a UIActionSheet is shown via showInView: method, the actionSheet isn't in the view hierarchy at all. It's not a subview of the view passed as an argument to showInView:, it isn't added as a subview of the key window, and it doesn't create its own window. How does it appear, then? I haven't tried this yet, so I'd like to know what happens in the keyWindow hierarchy when tabs in a UITabBarController are switched. Is the view of the selected UIViewController moved to the top, or does it work like with pushViewController:animated and presentModalViewController:animated, where only the displayed view is in the window hierarchy?

    Read the article

  • TTActionSheetController adding a UIPicker

    - by Ward
    I know how to add a uipicker to a uiactionsheet, how can one be added to the ttactionsheetcontroller? I see a reference to actionSheet within the controller, but setting the bounds to accommodate the uipicker doesn't seem to have any affect. And ideas? Best, Ward

    Read the article

  • Password protect iPhone app

    - by Thomas
    I'm starting a new app, and I'd like to know how to require a password to open it. I've been researching on Google and the Apple Dev Forums and haven't found anything. I was considering a UIActionSheet, but am unsure how to go about doing so. I'm going to keep trying though. Any suggestions here are greatly appreciated. Thanks! Thomas

    Read the article

  • issue of hide uipickerview in iphone

    - by M007
    I want to display UIPickerView with UIToolBar on the top of pickerView with done and cancel button.Attached is the screen shot for the same.I also have tab bar controller in bottom side of view and I want to display pickerView over bottom bar thats why I am using uipickerView inside of actionsheet.Now my issue is how to dismiss that pickerView on cancelButton click which is added in UIActionSheet? Following is the function to display pickerView : -(IBAction)setMile:(id)sender { menu = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; // Add the picker UIPickerView *pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0,55,0,0)]; pickerView.delegate = self; pickerView.showsSelectionIndicator = YES; // note this is default to NO UIToolbar *pickerToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0,0,320,44)]; pickerToolbar.barStyle = UIBarStyleBlackOpaque; [pickerToolbar sizeToFit]; NSMutableArray *barItems = [[NSMutableArray alloc] init]; UIBarButtonItem *cancelBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(setMileCancel:)]; [barItems addObject:cancelBtn]; [cancelBtn release]; cancelBtn=nil; UIBarButtonItem *flexSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil]; [barItems addObject:flexSpace]; [flexSpace release]; flexSpace=nil; UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(setMileDone:)]; [barItems addObject:doneBtn]; [doneBtn release]; doneBtn=nil; [pickerToolbar setItems:barItems animated:YES]; [barItems release]; barItems=nil; [menu addSubview:pickerToolbar]; [menu addSubview:pickerView]; [menu showInView:self.view]; //[menu showFromTabBar:[[self tabBarController] tabBar]]; this code is not working [menu setBounds:CGRectMake(0,0,320, 545)]; [pickerView release]; [menu release]; pickerView=nil; menu=nil; } I have following code on cancel button click -(IBAction)setMileCancel:(id)sender { //[menu removeFromSuperview]; [menu dismissWithClickedButtonIndex:0 animated:YES]; }

    Read the article

  • iPhone MFMailComposeViewController's "cancel" button displays Action Sheet w/ incorrect orientation.

    - by user211790
    I've been trying to add in-app email functionality and have been somewhat successful. The MailCompose view is displayed properly. But when "Cancel" is pressed the Action Sheet with "Delete", "Save as Draft" and "Cancel" animates in from the left as if the view controller is set to portrait mode*, yet the width (or height depending on how you look at it) is that of an action sheet in landscape mode as seen in the following image: http://dansandland.com/storage/screen-shot-2.png *The view controller is set to Landscape Left, both in the plist file and the shouldAutorotateToInterfaceOrientation method of all view controllers. MFMailComposeViewController code in a view controller: MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; [controller setSubject:@"In app email..."]; [controller setMessageBody:@"...email body." isHTML:NO]; [self presentModalViewController:controller animated:YES]; [controller release]; Any ideas?

    Read the article

  • Trying to debug a 'Assertion failure in -[UIActionSheet showInView:]' error....

    - by dsobol
    I am working through "Beginning iPad Application Development" and am getting hung up in Chapter 3 where I have created a project that works with an Action Sheet. As it stands now, my application loads into the simulator just fine with no errors that I am aware of, but as it runs, it crashes with the following errors showing up in the debugger window: 2010-05-31 19:44:39.703 UsingViewsActionSheet[49538:207] * Assertion failure in -[UIActionSheet showInView:], /SourceCache/UIKit_Sim/UIKit-1145.66/UIAlert.m:7073 2010-05-31 19:44:39.705 UsingViewsActionSheet[49538:207] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid parameter not satisfying: view != nil' I am sure that this is the block where the app breaks based upon my use of breakpoints. //Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"This is my Action Sheet!" delegate:self cancelButtonTitle:@"OK" destructiveButtonTitle:@"Delete Message!" otherButtonTitles:@"Option 1", @"Option 2", @"Option 3", nil]; [action showInView:self.view]; // <-- This line seems to trigger the crash.... [action release]; [super viewDidLoad]; } Am I missing something obvious, or is there more to the problem than is shown here? I have looked at the abstract for showInView and cannot divine anything there yet. I appreciate any and all asssitance. Regards, Steve O'Sullivan

    Read the article

  • Crash when trying to get NSManagedObject from NSFetchedResultsController after 25 objects?

    - by Jeremy
    Hey everyone, I'm relatively new to Core Data on iOS, but I think I've been getting better with it. I've been experiencing a bizarre crash, however, in one of my applications and have not been able to figure it out. I have approximately 40 objects in Core Data, presented in a UITableView. When tapping on a cell, a UIActionSheet appears, presenting the user with a UIActionSheet with options related to the cell that was selected. So that I can reference the selected object, I declare an NSIndexPath in my header called "lastSelection" and do the following when the UIActionSheet is presented: // Each cell has a tag based on its row number (i.e. first row has tag 0) lastSelection = [NSIndexPath indexPathForRow:[sender tag] inSection:0]; NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:lastSelection]; BOOL onDuty = [[managedObject valueForKey:@"onDuty"] boolValue]; UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Status" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:nil]; if(onDuty) { [actionSheet addButtonWithTitle:@"Off Duty"]; } else { [actionSheet addButtonWithTitle:@"On Duty"]; } actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; // Override the typical UIActionSheet behavior by presenting it overlapping the sender's frame. This makes it more clear which cell is selected. CGRect senderFrame = [sender frame]; CGPoint point = CGPointMake(senderFrame.origin.x + (senderFrame.size.width / 2), senderFrame.origin.y + (senderFrame.size.height / 2)); CGRect popoverRect = CGRectMake(point.x, point.y, 1, 1); [actionSheet showFromRect:popoverRect inView:[sender superview] animated:NO]; [actionSheet release]; When the UIActionSheet is dismissed with a button, the following code is called: - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex { // Set status based on UIActionSheet button pressed if(buttonIndex == -1) { return; } NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:lastSelection]; if([actionSheet.title isEqualToString:@"Status"]) { if([[actionSheet buttonTitleAtIndex:buttonIndex] isEqualToString:@"On Duty"]) { [managedObject setValue:[NSNumber numberWithBool:YES] forKey:@"onDuty"]; [managedObject setValue:@"onDuty" forKey:@"status"]; } else { [managedObject setValue:[NSNumber numberWithBool:NO] forKey:@"onDuty"]; [managedObject setValue:@"offDuty" forKey:@"status"]; } } NSError *error; [self.managedObjectContext save:&error]; [tableView reloadData]; } This might not be the most efficient code (sorry, I'm new!), but it does work. That is, for the first 25 items in the list. Selecting the 26th item or beyond, the UIActionSheet will appear, but if it is dismissed with a button, I get a variety of errors, including any one of the following: [__NSCFArray section]: unrecognized selector sent to instance 0x4c6bf90 Program received signal: “EXC_BAD_ACCESS” [_NSObjectID_48_0 section]: unrecognized selector sent to instance 0x4c54710 [__NSArrayM section]: unrecognized selector sent to instance 0x4c619a0 [NSComparisonPredicate section]: unrecognized selector sent to instance 0x6088790 [NSKeyPathExpression section]: unrecognized selector sent to instance 0x4c18950 If I comment out NSManagedObject *managedObject = [self.fetchedResultsController objectAtIndexPath:lastSelection]; it doesn't crash anymore, so I believe it has something do do with that. Can anyone offer any insight? Please let me know if I need to include any other information. Thanks! EDIT: Interestingly, my fetchedResultsController code returns a different object every time. Is this expected, or could this be a cause of my issue? The code looks like this: - (NSFetchedResultsController *)fetchedResultsController { /* Set up the fetched results controller. */ // Create the fetch request for the entity. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; // Edit the entity name as appropriate. NSEntityDescription *entity = [NSEntityDescription entityForName:@"Employee" inManagedObjectContext:self.managedObjectContext]; [fetchRequest setEntity:entity]; // Set the batch size to a suitable number. [fetchRequest setFetchBatchSize:80]; // Edit the sort key as appropriate. NSString *sortKey; BOOL ascending; if(sortControl.selectedSegmentIndex == 0) { sortKey = @"startTime"; ascending = YES; } else if(sortControl.selectedSegmentIndex == 1) { sortKey = @"name"; ascending = YES; } else { sortKey = @"onDuty"; ascending = NO; } NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:sortKey ascending:ascending]; NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortDescriptor, nil]; [fetchRequest setSortDescriptors:sortDescriptors]; // Edit the section name key path and cache name if appropriate. NSFetchedResultsController *aFetchedResultsController = [[NSFetchedResultsController alloc] initWithFetchRequest:fetchRequest managedObjectContext:self.managedObjectContext sectionNameKeyPath:nil cacheName:@"Root"]; aFetchedResultsController.delegate = self; self.fetchedResultsController = aFetchedResultsController; [aFetchedResultsController release]; [fetchRequest release]; [sortDescriptor release]; [sortDescriptors release]; NSError *error = nil; if (![fetchedResultsController_ performFetch:&error]) { /* Replace this implementation with code to handle the error appropriately. abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button. */ //NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } return fetchedResultsController_; } This happens when I set a breakpoint: (gdb) po [self fetchedResultsController] <NSFetchedResultsController: 0x61567c0> (gdb) po [self fetchedResultsController] <NSFetchedResultsController: 0x4c83630>

    Read the article

  • UITextField in UIAlertView doesn't respond to cut/copy/paste on second showing

    - by Jesse Grosjean
    I"m adding a UITextView to a UIAlertView with the following code: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter Name Here" message:@"this gets covered!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil]; UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60); [alert setTransform:myTransform]; [myTextField setBackgroundColor:[UIColor whiteColor]]; [alert addSubview:myTextField]; [alert show]; [alert release]; [myTextField release]; If I place that code in a standard action method: - (IBAction)testAlertView:(id)sender { ...the above code... } Then the first time I show the alert view the cut/copy/paste popup menu will show in the text fields that's been added to the alert view. (For instance if I tap and hold, then "Paste" will popup after I release. The problem is after working correctly the first time, none of the cut/copy/paste buttons will show up again when I show the alert view unless I restart the app. Does anyone know why, or how to fix this problem? Bonus information I just found out that I can get things to always work if I create an show the alert within a UIActionSheet delagate callback. For instance this always works (cut/copy/paste always shows up when in the UITextField when appropriate) - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { ...the above code... } Any idea what might be happening in this second case that make things work? I don't want to use a UIActionSheet in my app, so I'd like to find a way to make it work from a plain old action method. Thanks, Jesse

    Read the article

  • UITextField in UIAlertView doesn't respond to cut/copy/paste on second showing

    - by Jesse Grosjean
    Edit Reposting... I accidentally marked my previous question as "commuity wiki" and didn't realize that answers to wiki posts don't generate reputation. I"m adding a UITextView to a UIAlertView with the following code: UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Enter Name Here" message:@"this gets covered!" delegate:self cancelButtonTitle:@"Dismiss" otherButtonTitles:@"OK!", nil]; UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12, 45, 260, 25)]; CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0, 60); [alert setTransform:myTransform]; [myTextField setBackgroundColor:[UIColor whiteColor]]; [alert addSubview:myTextField]; [alert show]; [alert release]; [myTextField release]; If I place that code in a standard action method: (IBAction)testAlertView:(id)sender { ...the above code... } Then the first time I show the UIAlertView the cut/copy/paste popup menu will show in UITextField that's been added to the UIAlertView. (For instance if I tap and hold, then "Paste" will popup after I release. The problem is after working correctly the first time, none of the cut/copy/paste buttons will show up again next time I show the UIAlertView (new instance) unless I restart the app. Does anyone know why, or how to fix this problem? Bonus information I just found out that I can get things to always work if I create an show the alert within a UIActionSheet delagate callback. For instance this always works (cut/copy/paste always shows up when in the UITextField when appropriate) (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex { ...the above code... } Any idea what might be happening in this second case that make things work? I don't want to use a UIActionSheet in my app, so I'd like to find a way to make it work from a plain old action method. Thanks, Jesse

    Read the article

  • Change a UIButton View's background upon press

    - by Michael
    This should be easy but its got me stumped. I've got a button on each row of a table cell. The button is to delete the file associated with that row. I have an image that indicates if the file is present on the iPhone or not present. When the user presses the button, the target action method (showDeleteSheet) then calls a UIActionSheet with a variable to give it the indexPath of the row pressed. Then the user presses delete on the action sheet and the action sheet's clickedButtonAtIndex method deletes the file. Now, I need to update the button's background image property to change the image in the appropriate table cell to the not downloaded image. This can be done in either the button's target action method or the action sheet's clickedButtonAtIndex method. Here is some code: In the table's cellForRowAtIndexPath method I create the button: UIButton *deleteButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; [deleteButton addTarget:self action:@selector(showDeleteSheet:) forControlEvents:UIControlEventTouchDown]; deleteButton.frame = CGRectMake(246, 26, 30, 30); if (![AppData isDownloaded:[dets objectForKey:@"fileName"]]) { [deleteButton setBackgroundImage:notdownloadedImage forState:UIControlStateNormal]; } else { [deleteButton setBackgroundImage:notdownloadedImage forState:UIControlStateNormal]; } In the button's target method: -(void)showDeleteSheet:(id)sender { //get the cell row that the button is in NSIndexPath *indexPath = [table indexPathForCell:(UITableViewCell *)[[sender superview] superview]]; NSInteger currentSection = indexPath.section; NSInteger currentIndexRow = indexPath.row; NSLog(@"section = %i row = %i", currentSection, currentIndexRow); UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom]; [table reloadData]; //if deleteButton is declared in .h then the other instances of deleteButton show 'local declaration hides instance variable' [deleteButton setBackgroundImage:[UIImage imageNamed:@"not-downloaded.png"] forState:UIControlStateNormal]; UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Delete this file?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:nil]; actionSheet.tag = currentIndexRow; actionSheet.actionSheetStyle = UIActionSheetStyleDefault; [actionSheet showInView:self.view]; [actionSheet release]; } Perhaps the issue is that the call to [deleteButton setBackgroundImage...]; doesn't know which cell's button should be updated. If so I don't know how to tell it which. Because I test if the file is downloaded when the button is made and the background image is set, when I scroll down so the cell in question is de-queued then scroll back up it show's the correct image. I've tried to force the table to reload but [table reloadData]; is doing nothing. I've tried reloadRowsAtIndexPaths and still no good. Any one care to educate me on how this is done?

    Read the article

  • Passing NSArray Pointer Rather Than A Pointer To a Specific Type

    - by mattmccomb
    I've just written a piece of code to display a UIActionSheet within my app. Whilst looking at the code to initialise my UIActionSheet something struck me as a little strange. The initialisation function has the following signature... initWithTitle:(NSString *)title delegate:(id UIActionSheetDelegate)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles As you can see the otherButtonTitles parameter is a pointer to a String. In my code I set it as follows... otherButtonTitles: @"Title", @"Date", nil Although this compiles fine I don't really understand how it works. My reading of the statement is that I have created an inline array containing two elements (Title and Date). How come this then compiles? I'm passing a NSArray* in place of a NSString*. I know from a little of understanding of C++ that an array is really a pointer to the first element. So is this inline array that I'm creating a C array as opposed to a NSArray? What I'm hoping to achieve is to be able to pass a static NSArray* used elsewhere in my class to the otherButtonTitles parameter. But passing the NSArray* object directly doesn't work.

    Read the article

  • why can't I set a new instance's delegate as self?

    - by Guille10k
    I have a uipickerview, which appears with an ActionSheet. All this is in a class "MultiPicker". I create a new instance from "FirstViewController" this way: multiPicker *multiPic = [[multiPicker alloc]init]; multiPic.delegate = self; [multiPic action:aRunIndex]; And inside "multiPicker", in "action:" UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:title delegate:otroDelegate cancelButtonTitle:nil destructiveButtonTitle:@"Cancel" otherButtonTitles:@"Done", nil]; UIPickerView *pickerView = [[[UIPickerView alloc] init] autorelease]; pickerView.tag = 101; pickerView.delegate = self; pickerView.dataSource = self; pickerView.showsSelectionIndicator = YES; [actionSheet addSubview:pickerView]; [actionSheet showInView:self.view]; I need "FirstViewController" when MultiPicker finishes, so I can update a table in FirstView. I tried setting a new delegate to MultiPicker so, it tells FirstView when it finishes. But the instruction "multipic.delegate = self" in the first piece of code mades the app crash and says "Terminating due to uncaught exception". If I simply put all "MultiPicker" code inside FirstViewController class, not in a separate one, the action sheet stay blocked when I try to push a button different from "Cancel" Any idea? Thank u

    Read the article

  • How to resolve warning about does not implement the 'UIActionSheetDelegate' protocol

    - by RAGOpoR
    here is my .h code @interface ROSettingViewController : UITableViewController { UISwitch *switchCtl; UISwitch *switchCtl1; NSArray *dataSourceArray; } @property (nonatomic, retain, readonly) UISwitch *switchCtl; @property (nonatomic, retain, readonly) UISwitch *switchCtl1; @property (nonatomic, retain) NSArray *dataSourceArray; - (void)dialogOKCancelAction; - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex; @end /Users/ragopor/Desktop/Power Spot beta 2/code/Classes/ROSettingViewController.m:321: warning: class 'ROSettingViewController' does not implement the 'UIActionSheetDelegate' protocol

    Read the article

  • UIButton to intercept UITableView's didSelectRowAtIndexPath method

    - by Michael
    I've got a UIButton on a table cell that is meant to pop up a UIActionSheet but the problem is the didSelectRowAtIndexPath captures that touch and its action takes precedence. Any clever way to override that action when the user touches the button and still have the default action when the user presses elsewhere in the cell? Too bad there is no MoveToFront property.

    Read the article

  • Encoded nsstring becomes invalid, "normal" nsstring remains

    - by shoreline
    I'm running into a problem with a string that contains encoded characters. Specifically, if the string has encoded characters it eventually becomes invalid while a "normal" string will not. in the .h file: @interface DirViewController : TTThumbsViewController <UIActionSheetDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate> { NSString *sourceFolder; NSString *encodedSourceFolder; } @property (nonatomic, retain) NSString *sourceFolder; @property (nonatomic, retain) NSString *encodedSourceFolder; in the .m file: - (id)initWithFolder:(NSString*)folder query:(NSDictionary*)query { if (self = [super init]) { sourceFolder = folder; } return self; } Up to now everything seems to run as expected. In viewDidLoad I have the following: sourceFolderCopy = [self urlEncodeValue:(sourceFolder)]; //I also have this button, which I'll refer to later: UIBarButtonItem *importButton = [[UIBarButtonItem alloc] initWithTitle:@"Import/Export" style:UIBarButtonItemStyleBordered target:self action:@selector(importFiles:)]; self.navigationItem.rightBarButtonItem = importButton; Which uses the following method to encode the string (if it has characters I want encoded): - (NSString *)urlEncodeValue:(NSString *)str { NSString *result = (NSString *) CFURLCreateStringByAddingPercentEscapes (kCFAllocatorDefault, (CFStringRef)str, NULL, CFSTR(":/?#[]@!$&’()*+,;="), kCFStringEncodingUTF8); return [result autorelease]; } If I NSLog result, I get the expected values. If the string has characters like a white space, I get a string with encoding. If the string doesn't have any characters that need to be encoded, it just gives me the original string. I have a button on the nav bar which begins an image import process by opening an action sheet. Once the method for the action sheet starts, my string is invalid - but only if it contains encoded characters. If it is just a "normal" string, everything is fine and acts as expected. Am I off on my encoding? At first I thought it might be a memory problem but I can't figure out why that would affect only encoded strings. Here's where the action sheet is defined (and the first place I can see the encoded string becoming invalid) the NSLog statements are where it crashes: - (IBAction)importFiles:(id)sender { NSLog(@"logging encodedSF from import files:"); NSLog(@"%@",encodedSourceFolder);//crashes right here NSLog(@"%@",sourceFolder); if (shouldNavigate == NO) { NSString *msg = nil; msg = @"It is not possible to import or export images while in image selection mode."; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Unable to Import/Export" message:msg delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; [msg release]; } else{ UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"What would you like to do?" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Import Photos (Picker)", @"Export Photos", nil, nil]; [actionSheet showInView:self.view]; [actionSheet release]; } } I don't get any crash errors going to the console. By using breakpoints I was able to see that the encodedSourceFolder is invalid in the action sheet method.

    Read the article

< Previous Page | 1 2 3  | Next Page >