Search Results

Search found 15866 results on 635 pages for 'iphone 4g'.

Page 158/635 | < Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >

  • Cannot commit in sqlite using a wrapper

    - by user271753
    - (IBAction)SetupButtonPressed:(id)sender { Sqlite *sqlite = [[Sqlite alloc] init]; NSString *writableDBPath = [[NSBundle mainBundle]pathForResource:@"Money"ofType:@"sqlite"]; if (![sqlite open:writableDBPath]) return; [sqlite executeNonQuery:@"CREATE TABLE test (key TEXT NOT NULL, num INTEGER, value TEXT);"]; } Hey guys the above code runs at first but the next time , the table does not exists in the database ! I am using http://th30z.netsons.org/2008/11/objective-c-sqlite-wrapper/ what am I doing wrong ? Or could you please suggest me a really simple tutorial for core data ?

    Read the article

  • Determining the number of objects in an NSArray

    - by Viral
    Hi friends, I am making a book application. To move to the next topic I am using a button. The Button works as it moves to the next topic, but at the end of the file my application gets the message obj_fatal and it crashes. If I knew how many objects there are in my NSArray then the problem will be solved. I am getting the details from a .plist file and storing it in to a array. So if any one knows how, please let me know. Thanks in advance. Viral.

    Read the article

  • Sub-viewController doesn't get autorotation notifications, bug?

    - by Shizam
    If I have a view (and its controller) and I override the willAnimateRotationToInterfaceOrientation method so I can respond to autorotation events everything works fine and dandy. Now if I create another viewController and add its view to the first viewController's view via: [firstViewController.view addSubview:secondViewController.view] The secondViewController's willAnimateRotationToInterfaceOrientation method isn't called. What gives? Thanks, Sam

    Read the article

  • To stop CALayer from overlapping each other

    - by gbf.sara
    I've an image placed over the CALayer.. When there are multiple images in screen, the images in the layer overlaps each other.. But it shudn't overlap actually. Cud anyone help me in fixing this??? Is there any block of code to prevent them from overlapping??? Tanx in advance for ur help...

    Read the article

  • "Warning reaching end of non-void fuction" with Multiple Sections that pull in multiple CustomCells

    - by Newbyman
    I'm getting "Reaching end of non-void function" warning, but don't have anything else to return for the compiler. How do I get around the warning?? I'm using customCells to display a table with 3 Sections. Each CustomCell is different, linked with another viewcontroller's tableview within the App, and is getting its data from its individual model. Everything works great in the Simulator and Devices, but I would like to get rid of the warning that I have. It is the only one I have, and it is pending me from uploading to App Store!! Within the - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {, I have used 3 separate If() statements-(i.e.==0,==1,==2) to control which customCells are displayed within each section throughout the tableview's cells. Each of the customCells were created in IB, pull there data from different models, and are used with other ViewController tableViews. At the end of the function, I don't have a "cell" or anything else to return, because I already specified which CustomCell to return within each of the If() statements. Because each of the CustomCells are referenced through the AppDelegate, I can not set up an empty cell at the start of the function and just set the empty cell equal to the desired CustomCell within each of the If() statements, as you can for text, labels, etc... My question is not a matter of fixing code within the If() statements, unless it is required. My Questions is in "How to remove the warning for reaching end of non-void function-(cellForRowAtIndexPath:) when I have already returned a value for every possible case: if(section == 0); if(section == 1); and if(section == 2). *Code-Reference: The actual file names were knocked down for simplicity, (section 0 refers to M's, section 1 refers to D's, and section 2 refers to B's). Here is a sample Layout of the code: //CELL FOR ROW AT INDEX PATH: -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { //Reference to the AppDelegate: MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication sharedApplication] delegate]; //Section 0: if(indexPath.section == 0) { static NSString *CustomMCellIdentifier = @"CustomMCellIdentifier"; MCustomCell *mCell = (MCustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomMCellIdentifier]; if (mCell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"MCustomCell" owner:tableView options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[MCustomCell class]]) mCell = (MCustomCell *)oneObject; } //Grab the Data for this item: M *mM = [appDelegate.mms objectAtIndex:indexPath.row]; //Set the Cell [mCell setM:mM]; mCell.selectionStyle =UITableViewCellSelectionStyleNone; mCell.root = tableView; return mCell; } //Section 1: if(indexPath.section == 1) { static NSString *CustomDCellIdentifier = @"CustomDCellIdentifier"; DCustomCell *dCell = (DCustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomDaddyCellIdentifier]; if (dCell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"DCustomCell" owner:tableView options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[DCustomCell class]]) dCell = (DCustomCell *)oneObject; } //Grab the Data for this item: D *dD = [appDelegate.dds objectAtIndex:indexPath.row]; //Set the Cell [dCell setD:dD]; //Turns the Cell's SelectionStyle Blue Highlighting off, but still permits the code to run! dCell.selectionStyle =UITableViewCellSelectionStyleNone; dCell.root = tableView; return dCell; } //Section 2: if(indexPath.section == 2) { static NSString *CustomBCellIdentifier = @"CustomBCellIdentifier"; BCustomCell *bCell = (BCustomCell *)[tableView dequeueReusableCellWithIdentifier:CustomBCellIdentifier]; if (bCell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"BCustomCell" owner:tableView options:nil]; for (id oneObject in nib) if ([oneObject isKindOfClass:[BCustomCell class]]) bCell = (BCustomCell *)oneObject; } //Grab the Data for this item: B *bB = [appDelegate.bbs objectAtIndex:indexPath.row]; //Set the Cell [bCell setB:bB]; bCell.selectionStyle =UITableViewCellSelectionStyleNone; bCell.root = tableView; return bCell; } //** Getting Warning "Control reaches end of non-void function" //Not sure what else to "return ???" all CustomCells were specified within the If() statements above for their corresponding IndexPath.Sections. } Any Suggestions ??

    Read the article

  • Fault exception trashes a register causing a crash in [NSInvocation invoke]

    - by Mike Weller
    I have an NSOperation which fetches some objects from a core data persistent store and sums up a few totals. Sometimes an object is deleted while the operation in in progress, so a core data fault exception occurs. I try/catch the exception while summing to ignore it because I just want to skip objects that cannot be faulted in. However, when one of these fault exceptions occurs (and I swallow it) there is a crash after the invocation returns in [NSInvocation invoke]. It's a bad memory access when dereferencing the value in r10 which according to GDB on a successful run points to one of these: (gdb) x 0x38388348 0x38388348 <OBJC_IVAR_$_NSInvocation._retdata>: 0x00000008 If a fault exception occured a value of 0x02 is in the register which causes the crash. A quick google search tells me that r10 should be saved by the callee, meaning it is not being restored by whatever code is changing it when this exception occurs. Can anybody explain this? I'm not an expert when it comes to these kinds of low-level details

    Read the article

  • Why does Apple create it's views this way

    - by John Smith
    In the hope of fixing a bug of mine from another post i would like to know why apple writes this (for it's Elements example) UIView *localContainerView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; self.containerView = localContainerView; [localContainerView release]; instead of the simpler method: containerView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; ?

    Read the article

  • Call AppDelegate Method from Class

    - by golfromeo
    Basically, I need to call a method in my AppDelegate from one of my view controller classes. Currently, I'm doing the following: myAppDelegate *appDelegate = (myAppDelegate *)[[UIApplication sharedApplication] delegate]; [appDelegate doMethod]; And including the myAppDelegate.h at the top of the .m file of the class: #import "myAppDelegate.h" When I run it, everything works... But I get the following warning: warning 'myAppDelegate' may not respond to '-doMethod' Is there another way that I should reference the app delegate? Thanks for any help in advance.

    Read the article

  • How to split Code for iOS 3.0 and iOS 3.2 so I can use MPMoviePlayerViewController if OS 3.2++

    - by Allisone
    I have a video that I play. To use full screen in iOS 3.2 I use the MPMoviePlayerViewController (seems to only work with that Class). But if I want to build for iOS 3.0 I obviously get several errors, because this class is not known in iOS 3.0. I also know how to get what I want with MPMoviePlayerController in iOS 3.0, but I can only have one, either the code for iOS 3.0 or the code for iOS 3.2. How to cope with that ? I guess I have to use multiple targets, do you have suggestions on how to do that (always when I tried multiple targets I got errors and gave up :) ) ?

    Read the article

  • In cocos2D how to write a selector for a sprite.

    - by srikanth rongali
    Hello, I got problem in cocos2D application. I have a sprite and text in one screen. The text should be able to move up/down when we swipe. And when we select on the sprite it should take to next scene. So, both should have the istouchEnabled to YES. But text should take the touchesMoved and sprite should take touchesEnded. But my problem is either one is working. If am able to swipe the text, I am not able to select the sprite.( touchesEnded for sprite is not called). Please guide me, I am stuck here.

    Read the article

  • Length of data returned from CGImageGetDataProvider is larger than expected

    - by jcoplan
    I'm loading a grayscale png image and I want to access the underlying pixel data. However after I load get the pixel data via CGImageGetDataProvider, the length of the data returned is longer than expected. CCGDataProviderRef provider = CGDataProviderCreateWithFilename(cStr); CGImageRef image = CGImageCreateWithPNGDataProvider(provider, NULL, FALSE, kCGRenderingIntentDefault); mapWidth = CGImageGetWidth(image); mapHeight = CGImageGetHeight(image); lookupMap = CGDataProviderCopyData(CGImageGetDataProvider(image)); mapWidth comes out to 1804 and mapHeight comes out to 1005. The product of which is 1813020 When I call CFDataGetLength(lookupMap) the response is 1833120. Where are these extra 20100 bytes coming from? Any help here is much appreciated. Am I missing something about the underlying format of the image?

    Read the article

  • UIAlertView Will not show

    - by John
    I have a program that is requesting a JSON string. I have created a class that contains the connect method below. When the root view is coming up, it does a request to this class and method to load up some data for the root view. When I test the error code (by changing the URL host to 127.0.0.1), I expect the Alert to show. Behavior is that the root view just goes black, and the app aborts with no alert. No errors in debug mode on the console, either. Any thoughts as to this behavior? I've been looking around for hints to this for hours to no avail. Thanks in advance for your help. Note: the conditional for (error) is called, as well as the UIAlertView code. - (NSString *)connect:(NSString *)urlString { NSString *jsonString; UIApplication *app = [UIApplication sharedApplication]; app.networkActivityIndicatorVisible = YES; NSError *error = nil; NSURLResponse *response = nil; NSURL *url = [[NSURL alloc] initWithString:urlString]; NSURLRequest *req = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10]; NSData *_response = [NSURLConnection sendSynchronousRequest: req returningResponse: &response error: &error]; if (error) { /* inform the user that the connection failed */ //AlertWithMessage(@"Connection Failed!", message); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oopsie!" message:@"Unable to connect! Try later, thanks." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; [alert release]; } else { jsonString = [[[NSString alloc] initWithData:_response encoding:NSUTF8StringEncoding] autorelease]; } app.networkActivityIndicatorVisible = NO; [url release]; return jsonString; }

    Read the article

  • Detecting when a cell's detail-disclosure button has been clicked (when using a custom cell XIB)

    - by Gloria
    1 if (cell == nil) 2 { 3 [[NSBundle mainBundle] loadNibNamed:@"TVCell" owner:self options:nil]; 4 cell = tvCell; 5 self.tvCell = nil; 6 } There's some code from an Apple example of using your own "custom cell XIB" to create cells in a UITableView. It appears to work... but I think I would do better to actually UNDERSTAND what is being done there. Why isn't line #3 assigning the value TO something? cell = [[NSBundle mainBundle] loadNibNamed:@"TVCell" owner:self options:nil]; (In fact, cell and tvCell aren't being used at all.) Why is line #4 assigning using tvCell when nothing has been put it in at all, yet? Why is line #5 nulling out the tvCell that I need? Why is "@property (nonatomic, assign) IBOutlet UITableViewCell *tvCell;" using assign, not retain? About the only thing I can't get working correctly is when I put a disclosure-button on my custom cell XIB. Is there a way for me to detect when the user has clicked on it? (Hopefully, without using 100s of TAGs.)

    Read the article

  • Users adding views

    - by adamprocter
    I have created a main page (myAppViewController) and a add page rect button I have also created a page template (TemplateAViewController) all set up in Interface builder. I would like users to be able to add as many templates themselves and then page through them. I am not sure where to start. I can create views programmatic like so -(IBAction)createnewpage : (id) sender { myAppViewController *viewcontroller = [[myAppViewController alloc] initWithNibName:@"TemplateAViewController" bundle:[NSBundle mainBundle]]; [[self view] addSubview:viewcontroller.view]; } I then want to be able to navigate through these views- I guess I need to create a navigation controller to do this ?

    Read the article

  • Cycle backwards through NSArray

    - by dot
    Hello! I'm trying to cycle backwards through an array by clicking a button. My current code is close, but doesn't quite work. - (void)viewDidLoad { self.imageNames = [NSArray arrayWithObjects:@"MyFirstImage", @"AnotherImage", nil]; currentImageIndex = 0; [super viewDidLoad]; } ...what works: - (IBAction)change { UIImage* imageToShow = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[imageNames objectAtIndex:currentImageIndex] ofType:@"png"]; currentImageIndex++; if (currentImageIndex >= imageNames.count) { currentImageIndex = 0; } } ...and what isn't working: - (IBAction)changeBack { UIImage* imageToShow = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:[imageNames objectAtIndex:currentImageIndex] ofType:@"png"]; currentImageIndex--; if (currentImageIndex >= imageNames.count) { currentImageIndex = 0; } } Any help is gladly appreciated! Thanks!

    Read the article

  • UIGraphicsBeginImageContext question in Objective C

    - by Henry D'Andrea
    I need the UIGraphicsBeginImageContext(self.view.frame.size); changed to where the .frame part pulls from webView - (void) save { UIGraphicsBeginImageContext(self.view.frame.size); [self.view.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIImageWriteToSavedPhotosAlbum(viewImage, nil, nil, nil); NSLog(@"TEST"); } WEBVIEW CODE: -(BOOL) webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)ntype { NSLog(@"Scheme: %@", request.URL.scheme); if ([request.URL.scheme isEqualToString:@"save"]) { [self save]; } return true; }

    Read the article

  • Reducing the space between sections of the UITableView.

    - by flohei
    Hi there, is there a way to reduce the space between two sections of a UITableView? There are about 15 pixel between every single section I have. I did already try to return 0 for -tableView:heightForFooterInSection: and -tableView:heightForHeaderInSection: but that doesn't change anything. Any suggestions? Thanks in advance. –f

    Read the article

  • Guide me on UIDevice currentDevice

    - by barbgal
    I am using the following code to set the device orientaion [[UIDevice currentDevice] setOrientation:UIInterfaceOrientationLandscapeRight]; when i used i got the warning and i found the below code to fix that warning. @interface UIDevice (MyPrivateNameThatAppleWouldNeverUseGoesHere) - (void) setOrientation:(UIInterfaceOrientation)orientation; @end Now what i would like to know is ... Can the app store accepts this code to be in an application? Thanks for any help!.

    Read the article

  • help in selecting a row in a tableview and pushing that row into anotherview? sturgling on this sinc

    - by Madhu
    Hi, I have a list of about 5 items in a tableview which I bought them from a database and now when i am trying to push each of them into different views in DidSelectRow() what I am seeing is it is showing me all the views in all the categories.... here is the code I have written.... Here is the code written in cell for row at indexpath: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; } BeautyQuotes *bQuote = (BeautyQuotes*)[mBeautyQ objectAtIndex:indexPath.row]; cell.textLabel.text = bQuote.qBeauty; [cell setAccessoryType:UITableViewCellAccessoryDisclosureIndicator] ; return cell; and in didselectrow() i have written this code: id count1 = [mBeautyQ count]; while (count1--) { object = [mBeautyQ objectAtIndex:count1]; } [mBeautyQ release]; if([[object objectAtIndex:indexPath.row] isEqual : @"Beauty Quotes"]){ [tableView deselectRowAtIndexPath:indexPath animated:NO]; BeautysubViewController *subBeauty = [[BeautysubViewController alloc] initWithNibName:@"BeautysubViewController" bundle:nil]; //subBeauty.selected =[regions objectAtIndex:indexPath.row];(this is not working) [subBeauty setTitle:@"Beauty Quotes"]; NSLog(@"it is about push beauty subview controller"); [self.navigationController pushViewController:subBeauty animated:YES]; [subBeauty release]; } in this way i am pusing all the rows in to different views....but when I am pushing this into beautyquotes it is showing me all other views along with this.... struggling on this a lot please help me in dealing with this....

    Read the article

< Previous Page | 154 155 156 157 158 159 160 161 162 163 164 165  | Next Page >