Search Results

Search found 3754 results on 151 pages for 'ios simulator'.

Page 70/151 | < Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >

  • Calling popToRootViewControllerAnimated causing crash. How should I be doing this?

    - by Lewis42
    The app is for taking body measurements. The user can say I want to measure: legs, arms and neck, in the settings tab and in the main tab there is a view which loops round to take each measurement. This is achieved like so: i have tab controller the first tab has a navigation controller the first view controller on the storyboard and has one segue to itself the board loops round until it has all the measurements then it segues to a different controller the problem is: if the user changes which measurements they are taking in the settings tab, the first tab needs to completely reload, as if the app was just starting up, clearing down the whole nav stack etc. at the moment the tab controller calls popToRootViewControllerAnimated on the navigation controller in the measurements tab, but this is causing a crash. Each screen has a slider control and a call to titleForRow:forComponent: is being called on a deleted view causing it to crash. What am I doing wrong?! Here's the tab bar controller code // TabBarController.m // #import "TabBarController.h" #import "TodaysMeasurementObject.h" #import "AppDelegateProtocol.h" #import "AddMeasurementViewController.h" #import "ReadPerson.h" #import "AppDelegate.h" @interface TabBarController () <UITabBarControllerDelegate> @end @implementation TabBarController bool resetWizardView = false; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.delegate = self; [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(measurementsSettingsUpdated:) name:@"MeasurementsSettingsUpdated" object:nil]; } - (void) measurementsSettingsUpdated:(NSNotification *) notification { // UINavigationController *navigationController = [self.viewControllers objectAtIndex:0]; // AddMeasurementViewController *addMeasurement = [[AddMeasurementViewController alloc] init]; // [navigationController setViewControllers: [[NSArray alloc] initWithObjects:addMeasurement, nil]]; resetWizardView = YES; } - (void) viewDidAppear:(BOOL)animated { if (![ReadPerson userHasRecords]) { [self setSelectedIndex:3]; } } - (void)orientationChanged:(NSNotification *)notification { // We must add a delay here, otherwise we'll swap in the new view // too quickly and we'll get an animation glitch [self performSelector:@selector(showGraphs) withObject:nil afterDelay:0]; } - (void)showGraphs { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; if (deviceOrientation == UIDeviceOrientationLandscapeLeft && !isShowingLandscapeView) { [self performSegueWithIdentifier: @"toGraph" sender: self]; isShowingLandscapeView = YES; } else if (deviceOrientation != UIDeviceOrientationLandscapeLeft && isShowingLandscapeView) { [self dismissModalViewControllerAnimated:YES]; isShowingLandscapeView = NO; } } - (void)viewDidUnload { [super viewDidUnload]; // Release any retained subviews of the main view. } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if(interfaceOrientation == UIInterfaceOrientationLandscapeRight) { [self performSegueWithIdentifier: @"toGraph" sender: self]; } return false; } - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController { int tbi = tabBarController.selectedIndex; if (tbi == 0) { [[viewController view] setNeedsDisplay]; if (resetWizardView) { [(UINavigationController*)[self.viewControllers objectAtIndex:0] popToRootViewControllerAnimated: NO]; // ******* POP CALLED HERE ****** resetWizardView = false; } } } - (TodaysMeasurementObject*) theAppDataObject { id<AppDelegateProtocol> theDelegate = (id<AppDelegateProtocol>) [UIApplication sharedApplication].delegate; TodaysMeasurementObject* theDataObject; theDataObject = (TodaysMeasurementObject*) theDelegate.theAppDataObject; return theDataObject; } - (BOOL)shouldAutorotate { return NO; } - (NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } @end UPDATED - (void) measurementsSettingsUpdated:(NSNotification *) notification { NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithArray: self.viewControllers]; UINavigationController *navigationController = [viewControllers objectAtIndex:0]; AddMeasurementViewController *addMeasurement = [[AddMeasurementViewController alloc] init]; [navigationController setViewControllers: [[NSArray alloc] initWithObjects:addMeasurement, nil]]; [viewControllers setObject:navigationController atIndexedSubscript:0]; self.viewControllers = viewControllers; } and removed the code from - tabBarController:didSelectViewController: but still the same error. I think the problem is that it's trying to get a value for the slide control after the view has been deleted. But some part of the view must still be alive...? Anyway to kill that off? Or leave it all alive??

    Read the article

  • Adding a UIView to a UITableViewCell via cell.contentView

    - by Robert Eisinger
    I have a class called GraphView that extends UIView that basically draws a small little line chart. I need one of these graphs at the top of each section in my UITableView. So I tried by creating a separate cell at the top of one of my sections and then on that cell I did: [cell.contentView addSubview:graphView]; [graphView release]; But when I scroll down, it's like the graph is glitchy and it shows up in random spots along the UITableView. Anyone have ideas or insight? Is there a better way to incorporate another UIView into the top of each section in my UITableView?

    Read the article

  • How can I get the Twitter following and follower Email id and MobileNo in the iPhone sdk Using MGTwitterEngine?

    - by user1808090
    I'm unable to get the Twitter following and Followers Email id and MobileNo i am using below code for that using below code i am able to get only Twitter following name and Id Please help? if([[NSUserDefaults standardUserDefaults] valueForKey:@"UseridLoop"]==nil) { urlString = [NSString stringWithFormat:@"https://api.twitter.com/1/friends/ids.json?cursor=-1&user_id=%@",[[NSUserDefaults standardUserDefaults] valueForKey:@"Userid"]]; } else { urlString = [NSString stringWithFormat:@"https://api.twitter.com/1/followers/ids.json?cursor=-1&user_id=%@",[[NSUserDefaults standardUserDefaults] valueForKey:@"UseridLoop"]]; } NSURLRequest *notificationRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]; NSHTTPURLResponse *response; NSError *error; NSData *responData; responData = [NSURLConnection sendSynchronousRequest:notificationRequest returningResponse:&response error:&error]; NSLog(@"%@",responData); NSString *dataString = [[NSString alloc] initWithData:responData encoding:NSUTF8StringEncoding]; // NSDictionary *dict = [[NSDictionary alloc] initWithDictionary:(NSDictionary *)[dataString JSONValue]]; // // NSMutableDictionary *globalCelebDict=[[NSMutableDictionary alloc]initWithDictionary:(NSMutableDictionary *)[dataString JSONValue ] ]; // //NSMutableDictionary *globalCelebDictNext=[[NSMutableDictionary alloc]initWithDictionary:(NSMutableDictionary *)[[ globalCelebDict objectForKey:@"GetGroupDetailsResult"] JSONValue]]; // NSLog(@"dict %@",dict); SBJSON *json = [[SBJSON alloc] init]; NSMutableDictionary *customDetailDict=[[NSMutableDictionary alloc]init]; customDetailDict=[json objectWithString:dataString error:&error]; // NSDictionary *customDetailDict = [json objectWithString:dataString error:&error]; NSLog(@"%@",customDetailDict); if (customDetailDict!=nil) { array=[[customDetailDict objectForKey:@"ids"]retain]; NSLog(@"%@",array); NSLog(@"%d",[array count]); [[NSUserDefaults standardUserDefaults]removeObjectForKey:@"UseridLoop"]; NSLog(@"%@",[[NSUserDefaults standardUserDefaults]valueForKey:@"UseridLoop"]); } }

    Read the article

  • NavigationBar text colour not changing?

    - by Jeff
    In my tabbar application I am adding Navigation controller in each tab. Suppose the selected index is 0 when I opening the app.In my 3rd tab(selected index=2) I want to change the text colour of navigationbar title.And I am using the code [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor greenColor],UITextAttributeTextColor,nil]]; But its not changing the text color of Index 0 and 2.Colour of index 1 will change only if that tab was not clicked before changing the colour by using the above code. I don't know whats is the issue ? Any help/code will be appreciable.

    Read the article

  • Rhomobile vs. Phonegap considerations

    - by NewB
    I'm debating between Phonegap and RhoMobile for cross platform mobile application development. I'm a web developer with experience in Ruby as well as the traditional web technologies (HTML, CSS, and Javascript). The backend of this application will be accessed via a web browser and built with Rails. What are my chief concerns when choosing between these platforms? Which would you recommend I go with and WHY? Thank you

    Read the article

  • Not sure what happens to my apps objects when using NSURLSession in background - what state is my app in?

    - by Avner Barr
    More of a general question - I don't understand the workings of NSURLSession when using it in "background session mode". I will supply some simple contrived example code. I have a database which holds objects - such that portions of this data can be uploaded to a remote server. It is important to know which data/objects were uploaded in order to accurately display information to the user. It is also important to be able to upload to the server in a background task because the app can be killed at any point. for instance a simple profile picture object: @interface ProfilePicture : NSObject @property int userId; @property UIImage *profilePicture; @property BOOL successfullyUploaded; // we want to know if the image was uploaded to out server - this could also be a property that is queryable but lets assume this is attached to this object @end Now Lets say I want to upload the profile picture to a remote server - I could do something like: @implementation ProfilePictureUploader -(void)uploadProfilePicture:(ProfilePicture *)profilePicture completion:(void(^)(BOOL successInUploading))completion { NSUrlSession *uploadImageSession = ..... // code to setup uploading the image - and calling the completion handler; [uploadImageSession resume]; } @end Now somewhere else in my code I want to upload the profile picture - and if it was successful update the UI and the database that this action happened: ProfilePicture *aNewProfilePicture = ...; aNewProfilePicture.profilePicture = aImage; aNewProfilePicture.userId = 123; aNewProfilePicture.successfullyUploaded = NO; // write the change to disk [MyDatabase write:aNewProfilePicture]; // upload the image to the server ProfilePictureUploader *uploader = [ProfilePictureUploader ....]; [uploader uploadProfilePicture:aNewProfilePicture completion:^(BOOL successInUploading) { if (successInUploading) { // persist the change to my db. aNewProfilePicture.successfullyUploaded = YES; [Mydase update:aNewProfilePicture]; // persist the change } }]; Now obviously if my app is running then this "ProfilePicture" object is successfully uploaded and all is well - the database object has its own internal workings with data structures/caches and what not. All callbacks that may exist are maintained and the app state is straightforward. But I'm not clear what happens if the app "dies" at some point during the upload. It seems that any callbacks/notifications are dead. According to the API documentation- the uploading is handled by a separate process. Therefor the upload will continue and my app will be awakened at some point in the future to handle completion. But the object "aNewProfilePicture" is non existant at that point and all callbacks/objects are gone. I don't understand what context exists at this point. How am I supposed to ensure consistency in my DB and UI (For instance update the "successfullyUploaded" property for that user)? Do I need to re-work everything touching the DB or UI to correspond with the new API and work in a context free environment?

    Read the article

  • Adding a Main Menu to a Game in Xcode

    - by MasenB
    I am about done with an Objective - C Sprite Kit Development course on Lynda, and I wanted to expand on the app the course had me make! It was made so that once I open the app, it started brick breaker, and then there are more classes for additional scenes like Game Over and Restart! I was wondering if someone could tell me how to make a Main Menu view controller that came before the Brick Breaker screen! Thanks, Masen

    Read the article

  • How to deal with multiple Facebook requests simultaneously

    - by Peter Warbo
    I'm using the Facebook SDK for my app. I have created a singleton class FacebookHelper to deal with all Facebook related logic. Whenever I make a Facebook request (i.e download friends) I set an enum i.e FacebookRequestDownloadFriends so that FacebookHelper knows how to handle errors and success for that request (since handling can be different between the different requests) This solution has worked out fine until now, because now I'm doing 2 Facebook Requests at the same time so when I set the enum for the first request i.e FacebookRequestDownloadFriends and then it will be overwritten just shortly with another request FacebookRequestDownloadEvents, so there will be confusion obviously. How can I deal with this issue without having to refactor too much code?

    Read the article

  • Key-value pair request in ASIFormDataRequest does not get response

    - by onkar
    I am sending a key-value pair inorder to get jSON response.I am trying this way. NSString *url = SAMPLE_URL; ASIFormDataRequest *request =[[[ASIFormDataRequest alloc] init] autorelease]; request=[ASIFormDataRequest requestWithURL:url]; // NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; //[request setURL:[NSURL URLWithString:url]]; [request setHTTPMethod:@"POST"]; [request setPostValue:@"admin" forKey:@"username"]; [request setPostValue:@"123456" forKey:@"password"]; Issue The code is running fine, but no-response/acknowledgement is obtained. EDIT 1 [request setHTTPMethod:@"POST"]; has been changed to [request setRequestMethod:@"POST"];

    Read the article

  • AIR app still running when the iphone is blocked?

    - by nmarti
    I just made a simple game with flash professional 6.0 and adobe AIR sdk 3.4 for iPhone. The problem is this: when I lock the iphone pressing the power button, the screen switches off as usual, but the music of the game still sounds. If I exit the game pressing the home button it exits fine. Is only when locking the phone with the app opened. Also, I opted-out of multitasking for my app, so if I close my app with the home button and I reload it, it loads the main menu. Anyone knows how can I solve this?

    Read the article

  • Vfr/reader when to read a page

    - by juliet
    I downloaded vfr reader soure code on github. I am reading it, I found when need show a page of PDF, it will call showdocument method in showdocument method, it will new a readercontentview in readercontentview it will new a readercontentpage which has a citiedlayer delegate method called drawlayer:incontext I don't understand when and how to call this method, because there is no update for the readercontentview.

    Read the article

  • Question About id and Delegate Usage in Obj-C

    - by Stunner
    Ey guys, I am wondering what the following line of code is doing: @property (assign, nonatomic) id <CoursePlannerDelegate> delegate; Namely I am wondering about this portion of the line: id <CoursePlannerDelegate> delegate; It also shows up in other places: @interface CategoryAddViewController : UIViewController { UITextField *nameField, *weightField; double maxWeight; //The maximum weight that can be allocated to this Category (max value of 100) id <CategoryAddDelegate> delegate; //A Course Planner TVC } Any help appreciated, thanks in advance!

    Read the article

  • UIImage Object surprisingly returning null but not NSData

    - by riyaz
    i have created a sqlite db. and i have insert a few datas in my db.. UIImage * imagee=[UIImage imageNamed:@"image.png"]; NSData *mydata=[NSData dataWithData:UIImagePNGRepresentation(imagee)]; const char *dbpath = [databasePath UTF8String]; NSString *insertSQL=[NSString stringWithFormat:@"insert into CONTACTS values(\"%@\",\"%@\")",@"Mathan",mydata]; NSLog(@"mydata %@",mydata); sqlite3_stmt *addStatement; const char *insert_stmt=[insertSQL UTF8String]; if (sqlite3_open(dbpath,&contactDB)==SQLITE_OK) { sqlite3_prepare_v2(contactDB,insert_stmt,-1,&addStatement,NULL); if (sqlite3_step(addStatement)==SQLITE_DONE) { sqlite3_bind_blob(addStatement,1, [mydata bytes], [mydata length], SQLITE_TRANSIENT); NSLog(@"Data saved"); } else{ NSLog(@"Some Error occured"); } sqlite3_close(contactDB); } else{ NSLog(@"Failure"); } have written some codes to retrive the data sqlite3_stmt *statement; if (sqlite3_open([databasePath UTF8String], &contactDB) == SQLITE_OK) { NSString *sql = [NSString stringWithFormat:@"SELECT * FROM contacts"]; if (sqlite3_prepare_v2( contactDB, [sql UTF8String], -1, &statement, nil) == SQLITE_OK) { while (sqlite3_step(statement) == SQLITE_ROW) { char *field1 = (char *) sqlite3_column_text(statement, 0); NSString *field1Str = [[NSString alloc] initWithUTF8String: field1]; NSLog(@"UserName %@",field1Str); NSData *data = [[NSData alloc] initWithBytes:sqlite3_column_blob(statement, 1) length:sqlite3_column_bytes(statement, 1)]; UIImage *newImage = [[UIImage alloc]initWithData:data]; NSLog(@"Image OBJ %@",newImage); NSLog(@"Image Data %@",data); } sqlite3_close(contactDB); } } sqlite3_finalize(statement); the problem is in log, inserted NSData object and retrieved NSData Objects are different (printing in log gives different stream) moreover Image OBJ is printed null in log.. Have seen similar questions in stackoverflow. But nothing seems to help. Please give some suggestions to overcome this issue.

    Read the article

  • UIStoryboard load from app delegate

    - by Alessandro
    I am trying to load a UIStoryboard from the app delegate .m in this way: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { UIStoryboard *storybord = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle:[NSBundle mainBundle]]; UIViewController *vc =[storybord instantiateInitialViewController]; [self.window addSubview:vc.view]; return YES; } What is the problem with this code?? any idea?

    Read the article

  • UIsearch bar not returning data to table

    - by Insane_Poyo
    Edited code - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell==nil) cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; if (isFiltered) { int rowCount=indexPath.row; Aves *filtrada=[filteredTableData objectAtIndex:rowCount]; cell.textLabel.text=filtrada.name; NSLog(@"mostrando: "); }else { int rowCounter=indexPath.row; Aves *author=[theauthors objectAtIndex:rowCounter]; cell.textLabel.text=author.name; } NSLog(@"mostrando: "); return cell; } -(void)searchBar:(UISearchBar*)searchBar textDidChange:(NSString*)text { if(text.length == 0) { isFiltered = FALSE; } else { isFiltered = true; int i; [filteredTableData removeAllObjects]; for(i=0;[theauthors count]>i;i++) { Aves *name=[theauthors objectAtIndex:i]; //NSLog(name.name); NSRange nameRange = [[name.name lowercaseString] rangeOfString:[text lowercaseString]]; if(nameRange.length>0) { [filteredTableData addObject:name]; NSLog(name.name); } } [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO]; } } Edit: After working on it a while I solved some problems.Just updated my code, the problem is the repaint of the tableView, every thing else go ok. Check it and give any ideas you have plz ^^ Thx again for your time.

    Read the article

  • Change highlighting of certain subviews in a UITableViewCell

    - by SpacyRicochet
    Is it possible to exclude certain subviews in a UITableViewCell from being highlighted or to change their highlight implementation? I added an orange warning label to the UITableViewCell for certain occassions and it highlights properly with the rest of the cell, which is good. However, when the cells stops being highlighted in an animated way, you first see the background of the warning label become white and then flash to orange. I would either like it to be excluded from being highlighted at all, or to change it's highlight implementation so it animates back to orange properly.

    Read the article

  • Obj-c Turning long string into multidimensional array

    - by Phil
    I have a long NSString, something like "t00010000t00020000t00030000" and so on. I need to split that up into each "t0001000". I'm using... NSArray *tileData = [[GameP objectForKey:@"map"] componentsSeparatedByString:@"t"]; And it splits it up, but the "t" is missing, which I need (although I think I could append it back on). The other way I guess would be to split it up by counting 8 char's, although not sure how to do that. But ideally I need it split into a [][] type array so I can get to each bit with something like... NSString tile = [[tileData objectAtIndex:i] objectAtIndex:j]]; I'm new to obj-c so thanks for any help.

    Read the article

  • Add subview (rows) fast to UIScrollView while scrolling

    - by tikhop
    I have UIScrollView with a lot of rows (~100) and I implemented dequeueReusableRow method for fast allocating and adding my subviews (rows). Everything work fine, but if I scroll very fast with decelerate some view don't added to scrollView on time only later. - (UIView *)dequeueReusableRow { UIView *view = [reusableRows anyObject]; if(view) { [[view retain] autorelease]; [reusableRows removeObject:view]; }else{ view = [[UIView alloc] init.... } return view; } - (void)addVisibleRows { UIView *row = [self dequeueReusableRow]; row.frame = .... [scrollView addSubview:row] } - (void)scrollViewDidScroll:(UIScrollView *)scrollView { [self addVisibleRows]; [self removeInvisibleRows]; } Please, don't propose me use UITableView because structure of accordion looks like: section - section -- section --- row - section section - row

    Read the article

  • issue with keychain and updates from app store

    - by xonegirlz
    I am having a very frustrating error. I have tested for an app upgrade by first installing the previous version (1.0.1) and then running version (1.0.2). Everything worked fine. I submitted the app and then I am getting issues people are getting crashes when they upgrade. I tried doing the same thing, which is installing the 1.0.1 and then install the binary on the app store, then it crashed. I looked at the console and crash logs and I get this: Jul 7 08:07:45 unknown MyApp[1429] <Warning>: KeychainUtils keychainValueForKey: - Error finding keychain value for key. Status code = -25300 Jul 7 08:07:45 unknown MyApp[1429] <Warning>: AccountSession readUserDataFromDisk - Error finding keychain value for key /var/mobile/Applications/997B32E7-6FFC-4696-9CAA-129BADE2FE64/Documents/instagram_json Jul 7 08:07:45 unknown MyApp[1429] <Warning>: UISegmentedControlStyleBezeled is deprecated. Please use a different style. Jul 7 08:07:45 unknown MyApp[1429] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: username)' *** First throw call stack: (0x33ee688f 0x367e7259 0x33ee6789 0x33ee67ab 0x33e5368b 0x14fd99 0x152319 0x1530bb 0x170299 0x3270ec59 0x32711817 0x354e7dfb 0x354e7cd0) Jul 7 08:07:45 unknown UIKitApplication:com.firesnakelabs.pinstagram[0x14e4][1429] <Notice>: terminate called throwing an exception >

    Read the article

  • [picker dismissModalViewControllerAnimated:YES]; not working

    - by shishir.bobby
    I am using - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { } for imagepicker and using [picker dismissModalViewControllerAnimated:YES]; in iPad to dismiss the picker. also i tried using - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;{ [picker dismissModalViewControllerAnimated:YES]; } to dismiss the picker once it done the work. BUt its not dimissing it. when i tap anywhere in the screen, than only it gets dismiss. What i am doing wrong to dismiss the imagepicker? Many thnkas

    Read the article

  • Objective-C: iPad Crash When Screen Shot Button Clicked

    - by SeongHo
    OK, i am making a Coloring app and it has a "Save" button that will take the screen shot of the view where the drawing is. I have 6 images to color. In the intro page there 6 buttons, each will link you to a particular coloring page. All are working well including the "Save" button except for one. All coloring views has the same contents and functions but in one image, it crashes the iPad whenever i clicked the "Save" button. Here's some of my codes: On Button Click: [self saveScreenshotToPhotosAlbum]; camFlash = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)]; [camFlash setBackgroundColor:[UIColor whiteColor]]; [camFlash setAlpha:0.0]; [cbHolder addSubview:camFlash]; [cbHolder bringSubviewToFront:camFlash]; [UIView beginAnimations:@"Flash-On" context:NULL]; [UIView setAnimationDuration:0.2]; [UIView setAnimationRepeatAutoreverses:NO]; [camFlash setAlpha:1.0]; [UIView commitAnimations]; NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"flash" ofType:@"wav"]; AVAudioPlayer *flashSFX = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:soundPath] error:NULL]; flashSFX.volume = 0.5; flashSFX.numberOfLoops = 0; self->camFlashSFX = flashSFX; if ([flashSFX currentTime] != 0) [flashSFX setCurrentTime:0]; [flashSFX play]; [self performSelector:@selector(removeFlash) withObject:nil afterDelay:0.2]; Remove Flash: - (void) removeFlash { [camFlash removeFromSuperview]; } For the screenshot: - (UIImage*)captureView { UIGraphicsBeginImageContext(CGSizeMake(1024, 768)); CGContextRef context = UIGraphicsGetCurrentContext(); [cbHolder.layer renderInContext:context]; UIImage *img = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return img; } - (void)saveScreenshotToPhotosAlbum { UIImageWriteToSavedPhotosAlbum([self captureView], nil, nil, nil); } This one is for the button that will show the coloring page: uc4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tpUncolored1.png"]]; [uc4 setUserInteractionEnabled:YES]; [uc4 setFrame:CGRectMake(0, 0, 1024, 768)]; [cbHolder addSubview:uc4]; clrd4 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"tpColored1.png"]]; [clrd4 setUserInteractionEnabled:YES]; [clrd4 setFrame:CGRectMake(0, 0, 1024, 768)]; [cbHolder addSubview:clrd4]; [UIView beginAnimations:@"fabe-out" context:NULL]; [UIView setAnimationDuration:1.5]; [clrd4 setAlpha:0.0]; [UIView commitAnimations]; [self performSelector:@selector(cb4) withObject:nil afterDelay:1.5];

    Read the article

  • Multiple Notifications Not Firing

    - by motionpotion
    I'm scheduling two notifications as shown below. The app is a long-lived app. One local notification is scheduled to run every hour. The other is scheduled to run once per day. Only the second scheduled notification (the hourly notifcation) fires. - (void)scheduleNotification { LogInfo(@"IN scheduleNotification - DELETEYESTERDAY NOTIFICATION SCHEDULED."); UILocalNotification *notif = [[UILocalNotification alloc] init]; NSDictionary *deleteDict = [NSDictionary dictionaryWithObject:@"DeleteYesterday" forKey:@"DeleteYesterday"]; NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [[NSDateComponents alloc] init]; components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:[NSDate date]]; NSInteger day = [components day]; NSInteger month = [components month]; NSInteger year = [components year]; [components setDay: day]; [components setMonth: month]; [components setYear: year]; [components setHour: 00]; [components setMinute: 45]; [components setSecond: 0]; [calendar setTimeZone: [NSTimeZone systemTimeZone]]; NSDate *dateToFire = [calendar dateFromComponents:components]; notif.fireDate = dateToFire; notif.timeZone = [NSTimeZone systemTimeZone]; notif.repeatInterval = NSDayCalendarUnit; notif.userInfo = deleteDict; [[UIApplication sharedApplication] scheduleLocalNotification:notif]; } and then I schedule this after above: - (void)scheduleHeartBeat { LogInfo(@"IN scheduleHeartBeat - HEARTBEAT NOTIFICATION SCHEDULED."); UILocalNotification *heartbeat = [[UILocalNotification alloc] init]; NSDictionary *heartbeatDict = [NSDictionary dictionaryWithObject:@"HeartBeat" forKey:@"HeartBeat"]; heartbeat.userInfo = heartbeatDict; NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [[NSDateComponents alloc] init]; components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:[NSDate date]]; NSInteger day = [components day]; NSInteger month = [components month]; NSInteger year = [components year]; [components setDay: day]; [components setMonth: month]; [components setYear: year]; [components setHour: 00]; [components setMinute: 50]; [components setSecond: 0]; [calendar setTimeZone: [NSTimeZone systemTimeZone]]; NSDate *dateToFire = [calendar dateFromComponents:components]; heartbeat.fireDate = dateToFire; heartbeat.timeZone = [NSTimeZone systemTimeZone]; heartbeat.repeatInterval = NSHourCalendarUnit; [[UIApplication sharedApplication] scheduleLocalNotification:heartbeat]; } The above are scheduled when the app launches in the viewDidLoad of the main view controller. - (void)viewDidLoad { [self scheduleNotification]; [self scheduleHeartBeat]; [super viewDidLoad]; //OTHER CODE HERE } Then in the appdelegate I have the following: - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { LogInfo(@"IN didReceiveLocalNotification NOTIFICATION RECEIVED."); NSString *notificationHeartBeat = nil; NSString *notificationDeleteYesterday = nil; application.applicationIconBadgeNumber = 0; if (notification) { notificationHeartBeat = [notification.userInfo objectForKey:@"HeartBeat"]; notificationDeleteYesterday = [notification.userInfo objectForKey:@"DeleteYesterday"]; LogInfo(@"IN didReceiveLocalNotification HEARTBEAT NOTIFICATION TYPE: %@", notificationHeartBeat); LogInfo(@"IN didReceiveLocalNotification DELETEYESTERDAY NOTIFICATION TYPE: %@", notificationDeleteYesterday); } if ([notificationHeartBeat isEqualToString:@"HeartBeat"]) { //CREATE THE HEARTBEAT LogInfo(@"CREATING THE HEARTBEAT."); //CALL THE FUNCTIONALITY HERE THAT CREATES HEARTBEAT. } if ([notificationDeleteYesterday isEqualToString:@"DeleteYesterday"]) { //DELETE YESTERDAYS RECORDS LogInfo(@"DELETING YESTERDAYS RECORDS."); } } The notification that is scheduled last (scheduleHeartBeat) is the only notification that is fired. Could somebody help me figure out why this is happening?

    Read the article

  • Xcode automatically converts the object to NSArray

    - by Farrukh Javeid
    I have been working on an app and during the development, I am facing a very strange problem. I have a NSMutableArray tempSortedArray, which is full of objects of Store types. All the objects are valid as I can see them in my GUI, the problem arises when I iterate through the array, at index 90, which can be generally anyone, the XCode converts the Store object to NSMutableArray object. Any idea, why this is happening. This is the code to check out what I am doing: NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"cashBack" ascending:NO]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortDescriptor]; NSArray *sortedArray = [storesArray sortedArrayUsingDescriptors:sortDescriptors]; for (int i = 0; i < [tempSortedArray count]; i++) { Store *currentStore = [tempSortedArray objectAtIndex:i]; NSLog(@"store class: %@", [currentStore.class description]); if (currentStore.cashBackTypeString != (id)[NSNull null]) { //do whatever is required to do here }

    Read the article

  • coredate data not show at tableView

    - by pengwang
    hello,i used coredate at the tableView,when i enter the viewControl i will call: dispatch_queue_t downloadQueue = dispatch_queue_create("socket login", NULL); dispatch_async(downloadQueue, ^{ NSManagedObjectContext *managedObjectContext =[self getManagedObjectContext]; noticListArr=[[CoreDataManager sharedInstance] readEvent:@"NotificationEntity" SortDescriptor:nil managedObjectContext:managedObjectContext]; NSLog(@"refreshData.count:%d ",noticListArr.count); for(int i=0;i<noticListArr.count;i++){ NotificationEntity *notificationEntity=[noticListArr objectAtIndex:i]; NSLog(@"notificationEntity.name:%@ ",notificationEntity.name); NSLog(@"notificationEntity.describeString:%@ ",notificationEntity.describeString); NSLog(@"notificationEntity.source:%@", notificationEntity.source); } }); dispatch_async(dispatch_get_main_queue(), ^{ [self.tableView1 reloadData]; }); dispatch_release(downloadQueue); all log have value but when i used - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"NotificationViewCell"; NotificationViewCell *cell = (NotificationViewCell*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; NotificationEntity *notificationEntity=(NotificationEntity *)[noticListArr objectAtIndex:indexPath.row]; NSLog(@"tableViewnoticListArr.count:%d ",noticListArr.count); NSLog(@"indexPath.row:%d ",indexPath.row); NSLog(@"notificationTable.avatarsmall:%@", notificationEntity.avatarsmall); NSLog(@"notificationTable.source:%@", notificationEntity.source); NSLog(@"notificationTable.name:%@", notificationEntity.name); NSLog(@"notificationTable.describeString:%@ ",notificationEntity.describeString); } only NSLog(@"tableViewnoticListArr.count:%d ",noticListArr.count); NSLog(@"indexPath.row:%d ",indexPath.row); can give me correct result.but all notificationEntity.name notificationEntity.describeString is null.i donot know why at the tabelview cell all value of notificationEntity is null.

    Read the article

  • MonoTouch Load image in background

    - by user1058951
    I am having a problem trying to load an image and display it using System.Threading.Task My Code is as follows Task DownloadTask { get; set; } public string Instrument { get; set; } public PriceChartViewController(string Instrument) { this.Instrument = Instrument; DownloadTask = Task.Factory.StartNew(() => { }); } private void LoadChart(ChartType chartType) { NSData data = new NSData(); DownloadTask = DownloadTask.ContinueWith(prevTask => { try { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; NSUrl nsUrl = new NSUrl(chartType.Uri(Instrument)); data = NSData.FromUrl(nsUrl); } finally { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; } }); DownloadTask = DownloadTask.ContinueWith(t => { UIImage image = new UIImage(data); chartImageView = new UIImageView(image); chartImageView.ContentScaleFactor = 2f; View.AddSubview(chartImageView); this.Title = chartType.Title; }, CancellationToken.None, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.FromCurrentSynchronizationContext()); } The second Continue with does not seem to be being called? Initially my code looked like the following without the background processing and it worked perfectly. private void oldLoadChart(ChartType chartType) { UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; NSUrl nsUrl = new NSUrl(chartType.Uri(Instrument)); NSData data = NSData.FromUrl(nsUrl); UIImage image = new UIImage(data); chartImageView = new UIImageView(image); chartImageView.ContentScaleFactor = 2f; View.AddSubview(chartImageView); this.Title = chartType.Title; UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; } Does anyone know what I am doing wrong?

    Read the article

< Previous Page | 66 67 68 69 70 71 72 73 74 75 76 77  | Next Page >