xcode4.2

How do you save a picture with NSUserDefaults?

你离开我真会死。 提交于 2019-12-24 19:36:11
问题 I have a iPad app that can take a picture and then put it within a image view. How do I go about saving the pic that I have stored in the image view? Here is what I have tried so far: [imageView setImage:[[NSUserDefaults standardUserDefaults] objectForKey:@"storedImageValue6"]]; 回答1: Pretty much you have to convert it to NSData and vice versa. Take a look at this link: Save images in NSUserDefaults? 回答2: Here imageSet is UIImage NSData *imagedata=UIImagePNGRepresentation(imageSet); [

iOS Xcode 4.2 Master-Detail Application Template Throwing NSRangeException

断了今生、忘了曾经 提交于 2019-12-24 12:08:37
问题 Newbie question here ... I've created a Master-Detail Application project in Xcode 4.2 using ARC and Storyboard. I've modified the template to be: MasterViewController.h #import <UIKit/UIKit.h> @class DetailViewController; @interface MasterViewController : UITableViewController { NSMutableArray *items; } @property (strong, nonatomic) DetailViewController *detailViewController; @property (strong, nonatomic) NSMutableArray *items; @end MasterViewController.m (snipits) .... @synthesize items; ..

UIScrollView Content Offset on Load Not Reflected in UI for iOS 5

我只是一个虾纸丫 提交于 2019-12-24 10:59:31
问题 I recently upgraded to the latest SDK for iOS5 and am running into issues with a UIScrollView I have setup. The scrollview is dynamically sized depending on how many objects I want to show, and programatically adds objects to it. The issue I'm running into is that it is initializing the scrollview on load that has an offset even though I have the code: [scrollViewObj setContentOffset:CGPointZero]; I also sent the content offset coordinates to console at the end and it does register (0, 0),

cellForRowAtIndexPath returns null value

这一生的挚爱 提交于 2019-12-24 08:09:51
问题 I am working on an application, I have a UITableView which is populated with an NSMutableArray with the method tableView: cellForRowAtIndexPath:, it works fine but the problem is that i want to change the image for the tableViewCell, when i try to access the cell it returns null always. I am giving the code here, please tell me whether I am missing something... in the viewController.h file @interface DevicesViewController : UIViewController{ IBOutlet UITableView *deviceTableVIew;

XCode 4.2 - can't build to a device

会有一股神秘感。 提交于 2019-12-24 08:09:04
问题 I just updated my xcode to 4.2 and also my device to ios 5. Now that I've done that, I can't seem to be able to compile to my device. When I select compile to iOS device, in the previous XCode version, there used to be my device iOS version next to it but it's not there now. Also compiling, gives me this error. "No provisioned iOS devices are available with a compatible iOS version. Connect an iOS device with a recent enough version of iOS to run your application or choose an iOS simulator as

UITableView lags while scrolling

∥☆過路亽.° 提交于 2019-12-24 06:58:36
问题 here is my problem: My UITableViewController lags when I scroll it. It has about 60 custom cells. However, on the simulator it works without any lags. Here is my code: CustomCell.m #import "CustomCell.h" @implementation CustomCell @synthesize nameLabel,costLabel,giftPicture; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code nameLabel = [[UILabel

How to get Retina display iPad simulator in XCode 4.2, Mac OS 10.6.8 (Snow Loepard)

我与影子孤独终老i 提交于 2019-12-24 05:21:51
问题 i'v been looking to kick start my app development for the new iPad(iPad-3). But i could not find a place where i can download/update my XCode inorder to get the retina display simulator . Apple released XCode 4.3.1 with iOS 5.1 SDK . But that requires Mac OS 10.7.3(Lion). Is it mandatory for me to upgrade myself to Lion in order to start developing apps for the retina display iPad or can i get the same in Snow Leopard??? 回答1: I tried installing the same from Snow leopard and failed with error

Hide button on one touch itself

≯℡__Kan透↙ 提交于 2019-12-24 01:57:06
问题 i want to hide button on one touch itself. when the user touches the button that button should get hide but on one touch.The buttons are moving randomly. The moving buttons shoul get hide on touch. i have done it but after two three times pressing only it gets hide. i am using touchupinside event. Can anyone help me? -(IBAction)clickButton1:(id)sender { if (button1.tag==1) { button1.hidden=TRUE; } else { button1.hidden=FALSE; } } -(IBAction)clickButton2:(id)sender { if(button1.hidden==TRUE &&

How to save the selected MKAnnotation?

久未见 提交于 2019-12-23 19:35:53
问题 I have an app that has a mapview, and it shows 20 pins (from an Array) on the map. When the user clicks on it, it can show a bubble with a right accessory button. Here come my problem: How do I know which pin was pressed? I heard something about the mapView:didSelectAnnotationView method, but I don't really understand how do you get the pin/callout index, so that I can get the information of the object at the same index of my Array? Thanks for any help! 回答1: When that method gets called --

Xcode not showing anything in console with C++

↘锁芯ラ 提交于 2019-12-23 17:40:59
问题 I was just trying to use Xcode for a very small C++ project, and wanted to see some prints in the console, the thing is i did not see anything. I tried to run a very simple code instead: #include <iostream> int main (int argc, char * const argv[]) { std::cout << "Hello, World!\n"; printf("here"); return 0; } but still, nothing in Xcode console. any idea why? EDIT: adding snapshot of the program: EDIT 2: found this, and its working: How do I run a C++ program in XCode 4? 回答1: Your image doesn