Search Results

Search found 447 results on 18 pages for 'uibutton'.

Page 12/18 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Objecive C Error, Message sent to deallocated object

    - by Dave C
    Hello, I have several buttons on my app that are being created dynamically. They are all pointed at the button click event when pressed. When the button pressed method is called, the sender's tag(int value) is parsed into the controllers house ID. It works with one of the buttons... the first one created to be specific, but the others throw the following error: -[CFNumber intValue]: message sent to deallocated instance 0xc4bb0ff0 I am not releasing these buttons anywhere in my code... I haven't set them to auto release or anything like that... just wondering why they are doing this on the click. The button click event: - (IBAction) ButtonClick: (id) sender { HouseholdViewController *controller = [[HouseholdViewController alloc] initWithNibName:@"HouseholdViewController" bundle:nil]; controller.delegate = self; controller.HouseID = [(NSInteger)[(UIButton *)sender tag] intValue]; //this line throws an error controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; [controller release]; } Where I am creating the buttons: UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(MyLongInScreenCoords, MyLatInScreenCoords, 50, 50); UIImage *buttonImageNormal = [UIImage imageNamed:@"blue_pin.png"]; UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:50 topCapHeight:50]; [button setBackgroundImage:strechableButtonImageNormal forState:UIControlStateNormal]; [self.view addSubview:button]; button.tag = [NSNumber numberWithInt:[[words objectAtIndex: i] intValue]]; ButtonPoints[CurrentHouseCount][0] = button; ButtonPoints[CurrentHouseCount][1] = [NSValue valueWithCGPoint:CGPointMake(MyActualLat, MyActualLong)]; [button addTarget:self action:@selector(ButtonClick:) forControlEvents:UIControlEventTouchUpInside]; CurrentHouseCount++; Thank you for any assistance.

    Read the article

  • Why am I getting "Message sent to deallocated object" in Objective-C?

    - by Dave C
    I have several buttons on my app that are being created dynamically. They are all pointed at the button click event when pressed. When the button pressed method is called, the sender's tag (int value) is parsed into the controller's house ID. It works with one of the buttons — the first one created, to be specific — but the others throw the following error: -[CFNumber intValue]: message sent to deallocated instance 0xc4bb0ff0 I am not releasing these buttons anywhere in my code. I haven't set them to autorelease or anything like that. I'm just wondering why they are doing this on the click. The button click event: - (IBAction) ButtonClick: (id) sender { HouseholdViewController *controller = [[HouseholdViewController alloc] initWithNibName:@"HouseholdViewController" bundle:nil]; controller.delegate = self; controller.HouseID = [(NSInteger)[(UIButton *)sender tag] intValue]; //this line throws an error controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; [controller release]; } Where I am creating the buttons: UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(MyLongInScreenCoords, MyLatInScreenCoords, 50, 50); UIImage *buttonImageNormal = [UIImage imageNamed:@"blue_pin.png"]; UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:50 topCapHeight:50]; [button setBackgroundImage:strechableButtonImageNormal forState:UIControlStateNormal]; [self.view addSubview:button]; button.tag = [NSNumber numberWithInt:[[words objectAtIndex: i] intValue]]; ButtonPoints[CurrentHouseCount][0] = button; ButtonPoints[CurrentHouseCount][1] = [NSValue valueWithCGPoint:CGPointMake(MyActualLat, MyActualLong)]; [button addTarget:self action:@selector(ButtonClick:) forControlEvents:UIControlEventTouchUpInside]; CurrentHouseCount++;

    Read the article

  • Why am I getting "Message sent to deallocated instance" in Objective-C?

    - by Dave C
    I have several buttons on my app that are being created dynamically. They are all pointed at the button click event when pressed. When the button pressed method is called, the sender's tag (int value) is parsed into the controller's house ID. It works with one of the buttons — the first one created, to be specific — but the others throw the following error: -[CFNumber intValue]: message sent to deallocated instance 0xc4bb0ff0 I am not releasing these buttons anywhere in my code. I haven't set them to autorelease or anything like that. I'm just wondering why they are doing this on the click. The button click event: - (IBAction) ButtonClick: (id) sender { HouseholdViewController *controller = [[HouseholdViewController alloc] initWithNibName:@"HouseholdViewController" bundle:nil]; controller.delegate = self; controller.HouseID = [(NSInteger)[(UIButton *)sender tag] intValue]; //this line throws an error controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentModalViewController:controller animated:YES]; [controller release]; } Where I am creating the buttons: UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(MyLongInScreenCoords, MyLatInScreenCoords, 50, 50); UIImage *buttonImageNormal = [UIImage imageNamed:@"blue_pin.png"]; UIImage *strechableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:50 topCapHeight:50]; [button setBackgroundImage:strechableButtonImageNormal forState:UIControlStateNormal]; [self.view addSubview:button]; button.tag = [NSNumber numberWithInt:[[words objectAtIndex: i] intValue]]; ButtonPoints[CurrentHouseCount][0] = button; ButtonPoints[CurrentHouseCount][1] = [NSValue valueWithCGPoint:CGPointMake(MyActualLat, MyActualLong)]; [button addTarget:self action:@selector(ButtonClick:) forControlEvents:UIControlEventTouchUpInside]; CurrentHouseCount++;

    Read the article

  • Displaying modal view in Objective-C

    - by kpower
    I'm trying to display Modal View in my app. I have subclass of UIViewController that has only the "Done" button (UIButton created with IB and linked with XCode). .h @interface myModalVC : UIViewController { UIButton *bDone; } @property (nonatomic, retain) IBOutlet UIButton *bDone; - (IBAction)bDoneTouchDown:(id)sender; @end .m #import "myModalVC.h" @implementation myModalVC @synthesize bDone; - (void)dealloc { [bDone release]; [super dealloc]; } - (void)viewDidLoad { [super viewDidLoad]; } - (void)viewDidUnload { } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (UIInterfaceOrientationLandscapeLeft == interfaceOrientation || UIInterfaceOrientationLandscapeRight == interfaceOrientation); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (IBAction)bDoneTouchDown:(id)sender { [self.parentViewController dismissModalViewControllerAnimated:YES]; } @end I'm trying to display modal view with this code (from my main view): myModalVC *temp = [[[myModalVC alloc] initWithNibName:@"myModalVC" bundle:[NSBundle mainBundle]] autorelease]; [self presentModalViewController:temp animated:YES]; If this code is placed in some method, that responds to button touches - everything is fine. But when I place it to some other method (called during some processes in my app) - modal view is displayed without problems, but when I press (touch) "Done" button, application crashes with "Program received signal: “EXC_BAD_ACCESS”." What am I doing wrong?

    Read the article

  • Custom UITableView headerView disappears after memory warning

    - by psychotik
    I have a UITableViewController. I create a custom headerView for it's tableView in the loadView method like so: (void)loadView { [super loadView]; UIView* containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, width, height * 2 )]; containerView.tag = 'cont'; containerView.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; UIButton* button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(padding, height, width, height); ... //configure UIButton and events UIImageView* imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"] highlightedImage:[UIImage imageNamed:@"highlight.png"]]; imageView.frame = CGRectMake(0, 0, width, height ); ... //configure UIImageView [containerView addSubview:button]; [containerView addSubview:imageView]; self.tableView.tableHeaderView = containerView; [imageView release]; [containerView release]; } None of the other methods (viewDidLoad/Unload, etc) are overloaded. This controller is hosted in a tab. When I switch to another tab and simulate a memory warning, and then come back to this tab, my UITableView is missing my custon header. All the rows/section are visible as I would expect. Putting a BP in the loadView code above, I see it being invoked when I switch back to the tab after the memory warning, and yet I can't actually see the header. Any ideas about what I'm missing here? EDIT: This happens on the device and the simulator. On the device, I just let a memory warning occur by opening a bunch of different apps while mine is in the background.

    Read the article

  • CALayer Border is appearing above subview (Z-order related, I think)

    - by kurisukun
    I have searched but could not find the reason for this behavior. I have a UIButton whose image I am setting. Here is how the button should appear. Note that this is just a photoshop of the intended button design: Essentially, it is a square custom UIButton with a white border and a little surrounding shadow. In the upper right corner, there is a "X" mark, that will be added programmatically as a subview. Here is the screenshot of the button within the actual app. At this point, I have only added a shadow and the X mark as a subview: How, when I try to add the white border, here is what it looks like: It seems that the white border is appearing above the X mark sublayer. I don't know why. Here is the code that I am using: // selectedPhotoButton is the UIButton with UIImage set earlier // At this point, I am adding in the shadow [selectedPhotoButton layer] setShadowColor:[[UIColor lightGrayColor] CGColor]]; [[selectedPhotoButton layer] setShadowOffset: CGSizeMake(1.0f, 1.0f)]; [[selectedPhotoButton layer] setShadowRadius:0.5f]; [[selectedPhotoButton layer] setShadowOpacity:1.0f]; // Now add the white border [[selectedPhotoButton layer] setBorderColor:[[UIColor whiteColor] CGColor]]; [[selectedPhotoButton layer] setBorderWidth:2.0]; // Now add the X mark subview UIImage *deleteImage = [UIImage imageNamed:@"nocheck_photo.png"]; UIImageView *deleteMark = [[UIImageView alloc] initWithFrame:CGRectMake(53, -5, 27, 27)]; deleteMark.contentMode = UIViewContentModeScaleAspectFit; [deleteMark setImage:deleteImage]; [selectedPhotoButton addSubview:deleteMark]; [deleteMark release]; I don't understand why the border is appearing above the deleteMark subview. Is there any way to get the intended effect? Thank you!

    Read the article

  • Memory warning navigation controller

    - by fbiphone81
    Hi I'm new in iphone developing. The question is : I have a RootViewController with 2 uibutton. When i execute "memory monitor instrument on my iphone device OS3" RealMemory goes from 3.75M to 4.58M (I launch a uiview1controller by click on one UIbutton, then i close it and return to the RootViewController). When i close then uiview1 then memory goes to 4.22M. Why not to 3.75M? (uiview1controller is a simple test. nothing inside.) if i launch again uiview1controller memory increase from 4.22M and then retunrs to 4.22M. Correct. Then i launch uiview2controller from second uibutton. RealMemory goes from 4.22 to 6.01M. When i close the uiview1controller memory goes to 4.73M. Why not to 4.22? uiview1controller is a simple uiview with 3 uilabel and 3 uiimage designed with InterfaceBuilder and . the ONLY code write from me in uiview2controller is declare 3 iboutlet uitextfield and set uitextfileld text in loading. every time i launch the uiview2controller and close it memory increase of 0.51M ? What's worong? i tried to release iboutlet but it's the same. Thank you very much.

    Read the article

  • How to create a Facebook-App style notifications custom table?

    - by Tim Büthe
    I want to add a custom table to my iPhone app, that should look and work like the one used in the facebook app showing the notifications. It should contain rows with links in it. The text should be black, while the tap-able parts should appear blue. As a already figured out, labels only have one font, color and so on and you can't mix styles within it, I would have to use different components. The tab-able text parts maybe UIButtons with custom style without any border. I tried different approches to build the custom cell. I used Interface Builder, to layout components, but since the different parts have variable lengths they overlaid each other. I also tried to add instances of UIButton and UILabel as a subview to the cell's contentView as descibed in Apple's tutorial. The problem with this is that: The position and size of the components is fix and set when they get created using "initWithFrame:...". My code in "tableView:cellForRowAtIndexPath:" looks like this: UIButton *usernameButton; UILabel *mainLabel, *secondLabel; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { // cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0.0, 0.0, 220.0, 60.0) reuseIdentifier:CellIdentifier] autorelease]; [cell setBackgroundColor: [UIColor yellowColor]]; usernameButton = [[[UIButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 220.0, 15.0)] autorelease]; usernameButton.tag = USERNAME_BUTTON_TAG; // ... format, font etc. usernameButton.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight; [cell.contentView addSubview:usernameButton]; mainLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 20.0, 220.0, 15.0)] autorelease]; mainLabel.tag = MAINLABEL_TAG; // ... format, font etc. mainLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight; [cell.contentView addSubview:mainLabel]; secondLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 40.0, 220.0, 15.0)] autorelease]; secondLabel.tag = SECONDLABEL_TAG; // ... format, font etc. secondLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight; [cell.contentView addSubview:secondLabel]; } else { usernameButton = (UIButton *) [cell.contentView viewWithTag:USERNAME_BUTTON_TAG]; mainLabel = (UILabel *)[cell.contentView viewWithTag:MAINLABEL_TAG]; secondLabel = (UILabel *)[cell.contentView viewWithTag:SECONDLABEL_TAG]; } usernameButton.titleLabel.text = @"Peter"; mainLabel.text = @"sent you a message: ..."; secondLabel.text = @"11 minutes ago"; return cell; In a nutshell, I want to add the labels and buttons without a fix position or size, the buttons clickable and the cell height should automatically set according to the content. Here is an example of the cell's content: Peter sent you a message: "Hello! What are you doing?" Peter should be click/tab-able and his message, which has a variable length, should be italic and wrapped if necessary.

    Read the article

  • iphone custom navigation bar edit button

    - by Sarah
    Hi all, I use custom image for my navigation bar buttons using the following code, that allows me to make custom add button. I want to be able to do the same for the edit button item. UIImage *image=[UIImage imageNamed:@"Plus.png"]; UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; button.bounds = CGRectMake( 0, 0, image.size.width, image.size.height ); [button setBackgroundImage:image forState:UIControlStateNormal]; [button addTarget:self action:@selector(add) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *barButtonItem = [[UIBarButtonItem alloc] initWithCustomView:button]; self.navigationItem.rightBarButtonItem = barButtonItem; [barButtonItem release]; self.navigationItem.leftBarButtonItem = self.editButtonItem; I'm doing this because I want to change the button text color.I would appreciate your help, Sarah

    Read the article

  • Strange crashes when using MPMoviePlayerController in iPad and iPad simulator with iOS 4.2.

    - by Dave L
    I'm getting crashes when trying to play a movie using MPMoviePlayerController on the iPad and in the iPad simulator using iOS 4.2. I am building using xcode 3.2.5 and the 4.2 SDK. When running on an iPad using iOS 3.2 or in the iPad simulator 3.2, the same code works fine, but on an iPad running 4.2 or in the iPad simulator 4.2, it crashes. The crash is due to an exception for calling an unknown selector down somewhere deep in the cocoa libraries, something tries to call a selector called "setHitRectInsets:" on a UIButton object. Also, the crash happens after control has returned to the main event loop. Anybody have any idea what might be causing this? Here is the code (roughly, some extraneous stuff deleted that doesn't seem to have any effect) that is crashing: NSString *fullMovieFilename = [[NSBundle mainBundle] pathForResource:@"movie" ofType:@"m4v"]; NSURL *movieURL = [NSURL fileURLWithPath:fullMovieFilename]; moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; moviePlayer.controlStyle = MPMovieControlStyleNone; // crash happens regardless of the setting here [moviePlayer.view setFrame:self.view.bounds]; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES]; // crash happens whether i use fullscreen or not [moviePlayer play]; The same code also works just find if I build using Xcode 3.2.3 and the 4.0 SDK. The crash stack trace looks like this: 2011-03-04 23:08:22.017 MyApp[31610:207] -[UIButton setHitRectInsets:]: unrecognized selector sent to instance 0x990bc60 2011-03-04 23:08:22.020 MyApp[31610:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setHitRectInsets:]: unrecognized selector sent to instance 0x990bc60' *** Call stack at first throw: ( 0 CoreFoundation 0x0151abe9 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0166f5c2 objc_exception_throw + 47 2 CoreFoundation 0x0151c6fb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x0148c366 ___forwarding___ + 966 4 CoreFoundation 0x0148bf22 _CF_forwarding_prep_0 + 50 5 MediaPlayer 0x011b5bdb -[MPTransportControls createButtonForPart:] + 380 6 MediaPlayer 0x011b65d5 -[MPTransportControls _updateAdditions:removals:forPart:] + 110 7 MediaPlayer 0x011b4d78 -[MPTransportControls _reloadViewWithAnimation:] + 299 8 MediaPlayer 0x011b621a -[MPTransportControls setVisibleParts:] + 49 9 MediaPlayer 0x011b6e4a -[MPTransportControls initWithFrame:] + 173 10 MediaPlayer 0x011f9188 -[MPInlineTransportControls initWithFrame:] + 78 11 MediaPlayer 0x011f193a -[MPInlineVideoOverlay layoutSubviews] + 158 12 QuartzCore 0x00d6e451 -[CALayer layoutSublayers] + 181 13 QuartzCore 0x00d6e17c CALayerLayoutIfNeeded + 220 14 QuartzCore 0x00d6e088 -[CALayer layoutIfNeeded] + 111 15 MediaPlayer 0x011f130c -[MPInlineVideoOverlay setAllowsWirelessPlayback:] + 46 16 MediaPlayer 0x011f5b0d -[MPInlineVideoViewController _overlayView] + 526 17 MediaPlayer 0x011f6359 -[MPInlineVideoViewController _layoutForItemTypeAvailable] + 1350 18 Foundation 0x000e56c1 _nsnote_callback + 145 19 CoreFoundation 0x014f2f99 __CFXNotificationPost_old + 745 20 CoreFoundation 0x0147233a _CFXNotificationPostNotification + 186 21 Foundation 0x000db266 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 22 Foundation 0x000e75a9 -[NSNotificationCenter postNotificationName:object:] + 56 23 MediaPlayer 0x01184dd6 -[MPAVItem _updateForNaturalSizeChange] + 278 24 MediaPlayer 0x011818e4 __-[MPAVItem blockForDirectAVControllerNotificationReferencingItem:]_block_invoke_1 + 82 25 MediaPlayer 0x011899ba -[MPAVController _postMPAVControllerSizeDidChangeNotificationWithItem:] + 138 26 Foundation 0x000e56c1 _nsnote_callback + 145 27 CoreFoundation 0x014f2f99 __CFXNotificationPost_old + 745 28 CoreFoundation 0x0147233a _CFXNotificationPostNotification + 186 29 Foundation 0x000db266 -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 30 Celestial 0x052a35b2 -[NSObject(NSObject_AVShared) postNotificationWithDescription:] + 176 31 Celestial 0x052ab214 -[AVController fpItemNotification:sender:] + 735 32 Celestial 0x052b5305 -[AVPlaybackItem fpItemNotificationInfo:] + 640 33 Celestial 0x052a3d5c -[AVObjectRegistry safeInvokeWithDescription:] + 211 34 Foundation 0x000fa9a6 __NSThreadPerformPerform + 251 35 CoreFoundation 0x014fc01f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 36 CoreFoundation 0x0145a28b __CFRunLoopDoSources0 + 571 37 CoreFoundation 0x01459786 __CFRunLoopRun + 470 38 CoreFoundation 0x01459240 CFRunLoopRunSpecific + 208 39 CoreFoundation 0x01459161 CFRunLoopRunInMode + 97 40 GraphicsServices 0x01e4f268 GSEventRunModal + 217 41 GraphicsServices 0x01e4f32d GSEventRun + 115 42 UIKit 0x0038a42e UIApplicationMain + 1160 43 MyApp 0x0000837a main + 102 44 MpApp 0x00002009 start + 53 ) terminate called after throwing an instance of 'NSException' Been fighting with this for several days, and have searched the internet quite a bit for anybody having similar problems, all with no luck. Any suggestions would be greatly appreciated.

    Read the article

  • Custom annotationView images revert to pins when clicked

    - by Danny Tuppeny
    I'm displaying custom images on a map (instead of the default pins) using the code below. However, when I tap on an item (and the callout appears), the image reverts to the default red pin. How can I keep my custom image, even when the callout is displayed? - (MKAnnotationView *) mapView:(MKMapView *)map viewForAnnotation:(id <MKAnnotation>)annotation { MKPinAnnotationView *pinAnnotation = nil; if (annotation != mapView.userLocation) { static NSString *pinID = @"mapPin"; pinAnnotation = (MKPinAnnotationView *)[mapView dequeueReusableAnnotationViewWithIdentifier:pinID]; if (pinAnnotation == nil) pinAnnotation = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:pinID] autorelease]; // Set the image pinAnnotation.image = [UIImage imageNamed:@"TestIcon.png"]; // Set ability to show callout pinAnnotation.canShowCallout = YES; // Set up the disclosure button on the right side UIButton *infoButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; pinAnnotation.rightCalloutAccessoryView = infoButton; [pinID release]; } return pinAnnotation; [pinAnnotation release]; }

    Read the article

  • How to tell a rightCalloutAccessoryView has been touched for MapKit

    - by iamdadude
    I have a MKAnnotationView being allocated with a DetailDisclosure button being displayed on the right side of the annotation. How would I go about knowing when a user clicked on the annotation button? This is what my code looks like right now - UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; pinView.rightCalloutAccessoryView = rightButton; pinView.animatesDrop = YES; Is there a built in method to detect when a accessory view has been touched? I'm guessing it would be like the UITableView methods, but I can't find anything. Thanks for any help.

    Read the article

  • Why is my UIImageView blurred?

    - by Denis M
    I have a really weird problem with UIImageView. I have an image (an RGB png) 45x45 pixels which I add to the view. I can see that image is blurred after added to the view. Here is the same image in the simulator (left) and in Xcode (right): I have custom UIImageView class with this initWithImage code: - (id) initWithImage:(UIImage*) image { self = [super initWithImage:image]; self.frame = CGRectMake(0, 0, 45, 45); self.contentMode = UIViewContentModeScaleAspectFit; self.quantity = 1; if (self) { self.label = [[UITextField alloc]initWithFrame:CGRectMake(0,40,45,25)]; self.label.font = [UIFont systemFontOfSize:16]; self.label.borderStyle = UITextBorderStyleNone; self.label.enabled = TRUE; self.label.userInteractionEnabled = TRUE; self.label.delegate = self; self.label.keyboardType = UIKeyboardTypeNumbersAndPunctuation; self.label.textAlignment = UITextAlignmentCenter; } self.userInteractionEnabled = TRUE; // Prepare 3 buttons: count up, count down, and delete self.deleteButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; self.deleteButton.hidden = NO; self.deleteButton.userInteractionEnabled = YES; self.deleteButton.titleLabel.font = [UIFont systemFontOfSize:20]; self.deleteButton.titleLabel.textColor = [UIColor redColor]; [self.deleteButton setTitle:@"X" forState:UIControlStateNormal]; [self.deleteButton addTarget:self action:@selector(deleteIcon:) forControlEvents:UIControlEventTouchUpInside]; self.upCountButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; self.upCountButton.hidden = NO; self.upCountButton.userInteractionEnabled = YES; [self.upCountButton setTitle:@"+" forState:UIControlStateNormal]; [self.upCountButton addTarget:self action:@selector(addQuantity:) forControlEvents:UIControlEventTouchUpInside]; self.downCountButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; self.downCountButton.hidden = YES; self.downCountButton.userInteractionEnabled = YES; [self.downCountButton setTitle:@"-" forState:UIControlStateNormal]; [self.downCountButton addTarget:self action:@selector(removeQuantity:) forControlEvents:UIControlEventTouchUpInside]; return self; } I create it like this: UIImage *desertIcon = [UIImage imageNamed:@"desert.png"]; IconObj *desertIconView = [[IconObj alloc] initWithImage:desertIcon]; desertIconView.center = CGPointMake(265,VERTICAL_POINT_ICON); desertIconView.type = [IconObj TYPE_DESERT]; [self.view addSubview:desertIconView]; [desertIconView release]; Why would the displayed image be so than the one stored in a file?

    Read the article

  • set Image to Button

    - by Ivan
    Hello all, Could somebody help me a little bit with my issue below? When I call the myFunction, images which I want to set to buttons appear after 2 sec simultaneously, not one by one with delay of 0.5 sec. More info: generatedNumbers is array with four elements of NSNumber (4,1,3,2) buttons are set in UIView via IB and are tagged (1,2,3,4) -(IBAction) myFunction:(id) sender { int i, value; for (i = 0; i<[generatedNumbers count]; i++) { value = [[generatedNumbers objectAtIndex:i] intValue]; UIButton *button = (UIButton *)[self.view viewWithTag:i+1]; UIImage *img = [UIImage imageNamed:[NSString stringWithFormat:@"%d.png",value]]; [button setImage:img forState:UIControlStateNormal]; [img release]; usleep(500000); } }

    Read the article

  • Async call Objective C iphone

    - by Sam
    Hi guys, I'm trying to get data from a website- xml. Everything works fine. But the UIButton remains pressed until the xml data is returned and thus if theres a problem with the internet service, it cant be corrected and the app is virtually unusable. here are the calls: { AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; if(!appDelegate.XMLdataArray.count > 0){ [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [appDelegate GetApps]; //function that retrieves data from Website and puts into the array - XMLdataArray. } XMLViewController *controller = [[XMLViewController alloc] initWithNibName:@"MedGearsApps" bundle:nil]; [self.navigationController pushViewController:controller animated:YES]; [controller release]; } It works fine, but how can I make the view buttons functional with getting stuck. In other words, I just want the UIButton and other UIButtons to be functional whiles the thing works in the background. I heard about performSelectorInMainThread but i cant put it to practice correctly any help is appreciated :)

    Read the article

  • How can i see if dealloc is being called on a uikit object, or any object not created by myself

    - by Gyozo Kudor
    I think i have an UIImage that has a higher retain count than it should have and i am probably leaking memory. I use this image as a thumbnail, to set a custom background to a uibutton. So the uibutton is holding a reference to it and so do i. But instead of 2, the retainCount is 3. Do i have to create a custom UIImage derived class and override dealloc if I want to place a log message there and then change the class used from UIImage to my class, or is there an easier way. Thanks in advance.

    Read the article

  • iPhone: Add background button to view when UITableView has no cells

    - by Nic Hubbard
    I have a UITableViewController, when there is no data to populate the UITableView, I want to add a button, which uses an image. So, rather than the user seeing a tableview with no records, they will see an image that says, "No records have been added, Tap to add one", then they click and we create a new one. I assumed I would just hide the UITableView, then create the button, but I never see the button. Here I am using: if ([[fetchedResultsController sections] count] == 0) { self.tableView.hidden = YES; // Create button w/ image UIButton * btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(0, 0, 100, 50); [btn setImage:[UIImage imageNamed:@"no-rides.png"] forState:UIControlStateNormal]; [self.view addSubview:btn]; } Ideas on why I would never see the button? When I show this view, it seems to have a transparent background for a second, then changes white...

    Read the article

  • how to remove sub views.

    - by mac
    Hi I have added UIButton,UITextView as subview to my view, programatically. notesDescriptionView = [[UIView alloc]initWithFrame:CGRectMake(0,0,320,460)]; notesDescriptionView.backgroundColor=[UIColor redColor]; [self.view addSubview:notesDescriptionView]; textView = [[UITextView alloc] initWithFrame:CGRectMake(0,0,320,420)]; [self.view addSubview:textView]; printf("\n description button \n"); button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@selector(cancel:) forControlEvents:UIControlEventTouchDown]; [button setTitle:@"OK" forState:UIControlStateNormal]; button.frame = CGRectMake(80.0, 420.0, 160.0, 40.0); [self.view addSubview:button]; here if we click the button , i need to remove the all the sub views, i am trying [self.view removeFromSuperView] but its not working any help.

    Read the article

  • Send Email in iphone

    - by user559080
    Hi, I am new to iphone. I am working on first app..I could design Email view by using Interface Builder. My requirement is, I have to add contact list. And choose required contact, when i clicked on To UIButton, It will be placed on Address textfield. Finally, I can click the send UIButton, the email reach it's destination. How can I do this? Can anyone explain it and send me proper code. Image link is: http://img266.imageshack.us/img266/6447/emailau.png Thanks in Advance.

    Read the article

  • How can we know which cell is touched in tablView when a custom button in the cell is touched ?

    - by srikanth rongali
    I need to know which cell is touched when any button inside the cell is touched. I have custom UIButton *button1 in the cell and UIButton *button2 on the cell.imageView.image of the cell. I wrote selectors for both buttons.; But, I could not differentiate the buttons for each cell. How do I know which cell button was touched. What to do, to know that a particular cell's button was touched ? Thank you.

    Read the article

  • How to find which annotation send showDetails?

    - by Voloda2
    How to find which annotation send showDetails? MKPinAnnotationView* customPinView = [[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:BridgeAnnotationIdentifier] autorelease]; customPinView.pinColor = MKPinAnnotationColorPurple; customPinView.animatesDrop = YES; customPinView.canShowCallout = YES; // add a detail disclosure button to the callout which will open a new view controller page // // note: you can assign a specific call out accessory view, or as MKMapViewDelegate you can implement: // - (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control; // UIButton* rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; [rightButton addTarget:self action:@selector(showDetails:) forControlEvents:UIControlEventTouchUpInside]; customPinView.rightCalloutAccessoryView = rightButton; return customPinView; - (void)showDetails:(id)sender { some code }

    Read the article

  • How to implement action in didSelectRowAtIndexPath of UITableview?

    - by Sumana Mehta
    On my view, I used to have few buttons and each button had an action associated with it. UIButton *testButton = [[UIButton alloc] initWithFrame:CGRectMake(120,300,90,90)]; [testButton setBackgroundImage:[UIImage imageNamed:@"test.jpg"] forState:UIControlStateNormal]; [testButton addTarget:self.view action:@selector(gotoProd:) forControlEvents:UIControlEventTouchUpInside]; [testButton addt [scrollView testButton]; But now I am trying to replace all those buttons with the tableview with rows. I was able to populate the rows and I know one needs to use didSelectRowAtIndexPath for handling on select event of the cell. But how can I implement action:@selector(gotoProd:) in tableviews ?? Any help will be greatly appreciated.

    Read the article

  • identifying Button selection of each row in Tableview?

    - by senthilmuthu
    hi,i coded like - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn.frame = CGRectMake(230.0f, 4.0f, 60.0f, 36.0f); [btn setTitle:@"OK" forState:UIControlStateNormal]; [btn setTitle:@"OK" forState:UIControlStateSelected]; [btn addTarget:self action:@selector(onClickRename:) forControlEvents:UIControlEventTouchUpInside]; [cell addSubview:btn]; return cell; } but if the user selects the button on particular row, i can change that image through onClickRename...but can i get inwhich row's image has been touched through (void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath)indexPath ?

    Read the article

  • Problem in to navigate on UITableView on the UIButtonClick which is present in UITabBarController sc

    - by Rajendra Bhole
    Hi, I develop an application in which i want to on UIButton Click the application navigate on UITableViewcontroller class.The UIButton is already on UITabBarController during the navigation the tab bar should be visible.The calling method in first tab bar controller class is, [appDelegate.nvcHome pushViewController:itemMenuTable animated:YES]; [itemMenuTable release]; itemMenuTable = nil; But it given me the following problem in GDB, Application tried to push a nil view controller on target . Also i want to display the icon and title of UITabBarController in programmatically, the code is, homeViewControllerLink = [[homeViewController alloc]initWithNibName:@"homeViewController" bundle:nil]; nvcHome = [[UINavigationController alloc]initWithRootViewController:homeViewControllerLink]; nvcHome.navigationBar.barStyle = UIStatusBarStyleBlackOpaque; UIImage *imgHomeTab = [UIImage imageNamed:@"home"]; [nvcHome.tabBarItem initWithTitle:@"Home" image:imgHomeTab tag:101]; [homeViewControllerLink release]; But it does not display when i running my app on iphone simulator.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18  | Next Page >