Search Results

Search found 4899 results on 196 pages for 'ios newbie'.

Page 67/196 | < Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >

  • NSData in CoreData is not saving properly

    - by abisson
    I am currently trying to store images I download from the web into an NSManagedObject class so that I don't have to redownload it every single time the application is opened. I currently have these two classes. Plant.h @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) PlantPicture *picture; PlantPicture.h @property (nonatomic, retain) NSString * bucketName; @property (nonatomic, retain) NSString * creationDate; @property (nonatomic, retain) NSData * pictureData; @property (nonatomic, retain) NSString * slug; @property (nonatomic, retain) NSString * urlWithBucket; Now I do the following: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { PlantCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CellIdentifier forIndexPath:indexPath]; Plant *plant = [self.fetchedResultsController objectAtIndexPath:indexPath]; cell.plantLabel.text = plant.name; if(plant.picture.pictureData == nil) { NSLog(@"Downloading"); NSMutableString *pictureUrl = [[NSMutableString alloc]initWithString:amazonS3BaseURL]; [pictureUrl appendString:plant.picture.urlWithBucket]; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:pictureUrl]]; AFImageRequestOperation *imageOperation = [AFImageRequestOperation imageRequestOperationWithRequest:request success:^(UIImage *image) { cell.plantImageView.image = image; plant.picture.pictureData = [[NSData alloc]initWithData:UIImageJPEGRepresentation(image, 1.0)]; NSError *error = nil; if (![_managedObjectContext save:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); } }]; [imageOperation start]; } else { NSLog(@"Already"); cell.plantImageView.image = [UIImage imageWithData:plant.picture.pictureData]; } NSLog(@"%@", plant.name); return cell; } The plant information is present, as well as the picture object. However, the NSData itself is NEVER saved throughout the application opening and closing. I always have to REDOWNLOAD the image! Any ideas!? [Very new to CoreData... sorry if it is easy!] thanks!

    Read the article

  • What is the proper way to change the UINavigationController transition effect

    - by Felipe Sabino
    I have seen lots of people asking on how to push/pop UINavigationControllers using other animations besides the default one, like flip or curl. The problem is that either the question/answer was relative old, which means the have some things like [UIView beginAnimations:] (example here) or they use two very different approaches. The first is to use UIView's transitionFromView:toView:duration:options:completion: selector before pushing the controller (with the animation flag set to NO), like the following: UIViewController *ctrl = [[UIViewController alloc] init]; [UIView transitionFromView:self.view toView:ctrl.view duration:1 options:UIViewAnimationOptionTransitionFlipFromTop completion:nil]; [self.navigationController pushViewController:ctrl animated:NO]; Another one is to use CoreAnimation explicitly with a CATransaction like the following: // remember you will have to have the QuartzCore framework added to your project for this approach and also add <QuartzCore/QuartzCore.h> to the class this code is used CATransition* transition = [CATransition animation]; transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; transition.duration = 1.0f; transition.type = @"flip"; transition.subtype = @"fromTop"; [self.navigationController.view.layer removeAllAnimations]; [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; UIViewController *ctrl = [[UIViewController alloc] init]; [self.navigationController pushViewController:ctrl animated:NO]; There are pros and cons for both approaches. The first approach gives me a much cleaner code but restricts me from using animations like "suckEffect", "cube" and others. The second approach feels wrong just by looking at it. It starts by using undocumented transitions types (i.e. not present in the Common transition types documentation from CATransition Class Reference) which might get your app rejected from App Store (I mean might as I could not found any reference of apps being rejected because it was using this transactions, which I would also appreciate any clarification on this matter), but it gives you much more flexibility on your animations, as I can use other animation types such as "cameraIris", "rippleEffect" and so on. Regarding all that, do I really need to appeal for QuartzCore and CoreAnimation whenever I need a fancier UINavigationController transition? Is there any other way to accomplish the same effect using only UIKit? If not, will the use of string values like "flip" and "cube" instead of the pre-defined constants (kCATransitionFade, kCATransitionMoveIn, etc...) be an issue regarding my app approval in the App Store? Also, are there other pros and cons regarding both approaches that could help me deciding whether to choose each one of them?

    Read the article

  • UIButton performance in UITableViewCell vs UIView

    - by marcel salathe
    I'd like to add a UIButton to a custom UITableViewCell (programmatically). This is easy to do, but I'm finding that the "performance" of the button in the cell is slow - that is, when I touch the button, there is quite a bit of delay until the button visually goes into the highlighted state. The same type of button on a regular UIView is very responsive in comparison. In order to isolate the problem, I've created two views - one is a simple UIView, the other is a UITableView with only one UITableViewCell. I've added buttons to both views (the UIView and the UITableViewCell), and the performance difference is quite striking. I've searched the web and read the Apple docs but haven't really found the cause of the problem. My guess is that it somehow has to do with the responder chain, but I can't quite put my finger on it. I must be doing something wrong, and I'd appreciate any help. Thanks. Demo code: ViewController.h #import <UIKit/UIKit.h> @interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> @property UITableView* myTableView; @property UIView* myView; ViewController.m #import "ViewController.h" #import "CustomCell.h" @implementation ViewController @synthesize myTableView, myView; - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { [self initMyView]; [self initMyTableView]; } return self; } - (void) initMyView { UIView* newView = [[UIView alloc] initWithFrame:CGRectMake(0,0,[[UIScreen mainScreen] bounds].size.width,100)]; self.myView = newView; // button on regularView UIButton* myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [myButton addTarget:self action:@selector(pressedMyButton) forControlEvents:UIControlEventTouchUpInside]; [myButton setTitle:@"I'm fast" forState:UIControlStateNormal]; [myButton setFrame:CGRectMake(20.0, 10.0, 160.0, 30.0)]; [[self myView] addSubview:myButton]; } - (void) initMyTableView { UITableView *newTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,100,[[UIScreen mainScreen] bounds].size.width,[[UIScreen mainScreen] bounds].size.height-100) style:UITableViewStyleGrouped]; self.myTableView = newTableView; self.myTableView.delegate = self; self.myTableView.dataSource = self; } -(void) pressedMyButton { NSLog(@"pressedMyButton"); } - (void)viewDidLoad { [super viewDidLoad]; [[self view] addSubview:self.myView]; [[self view] addSubview:self.myTableView]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { CustomCell *customCell = [tableView dequeueReusableCellWithIdentifier:@"CustomCell"]; if (customCell == nil) { customCell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"CustomCell"]; } return customCell; } @end CustomCell.h #import <UIKit/UIKit.h> @interface CustomCell : UITableViewCell @property (retain, nonatomic) UIButton* cellButton; @end CustomCell.m #import "CustomCell.h" @implementation CustomCell @synthesize cellButton; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // button within cell cellButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [cellButton addTarget:self action:@selector(pressedCellButton) forControlEvents:UIControlEventTouchUpInside]; [cellButton setTitle:@"I'm sluggish" forState:UIControlStateNormal]; [cellButton setFrame:CGRectMake(20.0, 10.0, 160.0, 30.0)]; [self addSubview:cellButton]; } return self; } - (void) pressedCellButton { NSLog(@"pressedCellButton"); } @end

    Read the article

  • Animate screen while loading textures

    - by Omega
    My RPG-like game has random battles. When the player enters a random battle, it is necessary for my game to load the textures used within that battle (animated monsters, animations, etc). The textures are quite a lot, and rather big (the battles are very graphical intensive). Such process consumes significant time. And while it is loading, the whole screen freezes. The game's map freezes, and the wait time is significant - I personally find it annoying. I can't afford to preload the textures because, after doing some math, I realized: If I preload all the textures at the beginning of the game, the application will definitely crash. If I preload the textures that are used in a specific map when the player enters the map, the application is very likely to crash as well. I can only afford to load the textures when I need them, and dispose of them as soon as the battle ends. I'd prefer to not use a "loading screen" image because it affects my game's design and concept. I want to avoid this approach. If I could do some kind of animation while loading the textures, it would be great, which leads to my question: is that possible? What kind of animation, you ask? Well, how about... you remember when Final Fantasy used to distort the screen while apparently loading the textures? Something like that. But well, distorting is quite a time-consuming process as well, so maybe just a cool frame-by-frame animation or something. While writing this, I realized that I could make small pauses between textures (there are multiple textures), and during such pauses, I update the screen to represent the animation's state. However, this is very unlikely to happen, because each texture is 2048x2048, so the animation would be refreshed at a rather laggy (and annoying) rate. I'd prefer to avoid this as well.

    Read the article

  • Restore and preserve UIViewController pushed from UINavigationController, no storyboard

    - by user2908112
    I try to restore a simple UIViewController that I pushed from my initial view controller. The first one is preserved, but the second one just disappear when relaunched. I don't use storyboard. I implement the protocol in every view controller and add the restorationIdentifier and restorationClass to each one of them. The second viewController inherit from a third viewController and is initialized from a xib file. I'm not sure if I need to implement the UIViewControllerRestoration to this third since I don't use it directly. My code looks like typically like this: - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization self.restorationIdentifier = @"EditNotificationViewController"; self.restorationClass = [self class]; } return self; } -(void)encodeRestorableStateWithCoder:(NSCoder *)coder { } -(void)decodeRestorableStateWithCoder:(NSCoder *)coder { } +(UIViewController *)viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)coder { EditNotificationViewController* envc = [[EditNotificationViewController alloc] initWithNibName:@"SearchFormViewController" bundle:nil]; return envc; } Should perhaps the navigationController be subclassed so it too can inherit from UIViewControllerRestoration?

    Read the article

  • Sharing same properties of ViewController for iPhone Stroryboard and iPad Story Board

    - by Ruhul Amin
    I'm developing a universal application. in the first view, I have the login screen for the user. In iPhone storyBoard, I have added 2 text field and one button( login check). I have added properties in ViewController.h file by dragging those objects(Ctrl key + Dragg) to .h file. I have added code for login check and it is working fine for iPhone. This is the code in ViewController.h @property (strong, nonatomic) IBOutlet UITextField *txtUserId; @property (strong, nonatomic) IBOutlet UITextField *txtUserPwd; @property (strong, nonatomic) IBOutlet UIButton *btnLogin; In the iPad storyBoard, I have added 2 text field( userid and password) and i button for login. So now, I want to bind those objects with the veriable which I declared already in ViewController.h file in case of iPhone. My questions: 1. What is the right way to bind properties for both storyboard? 2. Am I on the right direction or should I think in a different way to do it? I am new with iPhone development. Please help. Thanks. --Amin

    Read the article

  • popViewControllerAnimated doesn't update info iPhone SDK

    - by WrightsCS
    When I try to pop a view controller, it doesnt update info for the previous view. Example: I have a cell that displays text in a label in View1. When you click on the cell it goes to View2 (for example) When I choose an option in View2, popViewControllerAnimated is used to go back to View1, however, I want the label to now be updated with the new option in View1. My dilemma is that when I pop View2, the label in View1 does not update. Any ideas? I've tried adding a [view1 reloadData]; before the view pops, but no luck. //VIEW1 the cell that displays the label. ringLabel = [[UILabel alloc] initWithFrame: CGRectMake(25, 12.7f, 250, 20)]; ringLabel.adjustsFontSizeToFitWidth = YES; ringLabel.textColor = [UIColor blackColor]; ringLabel.font = [UIFont systemFontOfSize:17.0]; ringLabel.backgroundColor = [UIColor clearColor]; ringLabel.textAlignment = UITextAlignmentLeft; ringLabel.tag = 0; ringLabel.text = [plistDict objectForKey:@"MYOPTION"]; [ringLabel setEnabled:YES]; [cell addSubview: ringLabel]; [ringLabel release]; //VIEW2 when cell clicked CustomProfileViewController *cpvc = [CustomProfileViewController alloc]; cpvc.ringtone = [ringList objectAtIndex:indexPath.row]; [cpvc.tblCustomTable reloadData]; [self.navigationController popViewControllerAnimated:YES];

    Read the article

  • How to have Xcode find the newest version of a file

    - by Arian
    Currently I have a SQLite database, that is set statically to use database01.sqlite... but what I need is a way to have the file path find the newest version of the database file that exists. For example: If a database file of database04.sqlite is available, it should use that one instead. Below is my current code: NSString *databaseDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *filePath = [databaseDirectory stringByAppendingPathComponent:@"database01.sqlite"];

    Read the article

  • How to get a green to show up like the charging battery on the iPhone lock screen?

    - by tarheel
    I am trying to get a color to show up on screen just like the charging battery (shown here): After looking at the Apple Documentation on UIColor here, I have attempted using both colorWithHue:saturation:brightness:aplha: and colorWithRed:green:blue:alpha: to get a color to show up like that. For example when I use colorWithHue:.3 saturation:.84 brightness:1 alpha:.5 on a black background, it renders a color like this: or the colorWithRed:0 green:1 blue:0 alpha:.5 on a black background shows up like this: It doesn't have that translucent or glossy look to it. Is there a better method to use? Or do I just not have the values right? (I have tried many combinations)

    Read the article

  • not saving when using setDidReceiveDataSelector

    - by coder4xc
    i want to download a file and show the progress bar i was able to do this. now , i want to show the progress value in a label and use this code to progress init and update label : [queue setDelegate:self]; [queue setRequestDidFinishSelector:@selector(updateLabel)]; [queue setDownloadProgressDelegate:progress]; [queue setShowAccurateProgress:YES]; ASIHTTPRequest *request; request = [ASIHTTPRequest requestWithURL:url]; [request setDelegate:self]; [request setTemporaryFileDownloadPath:[filePath stringByAppendingString:@".download"]]; [request setAllowResumeForFileDownloads:YES]; [request setDidFinishSelector:@selector(updateLabel)]; [request setDidReceiveDataSelector:@selector(updateLabel)]; [request setShouldContinueWhenAppEntersBackground:YES]; [request setShouldAttemptPersistentConnection:NO]; [request setDownloadDestinationPath:filePath]; [queue addOperation:request]; [queue go]; but not save in the destination path ! and when i clear this code :  [request setDidReceiveDataSelector:@selector(updateLabel)]; saving done ! what is problem ? i want to update label text when progress value changed

    Read the article

  • Store NSArray In Core Data Sample Code?

    - by Stunner
    Ey guys, I have been searching for some sample code on how to store an NSArray in Core Data for awhile now, but haven't had any luck. Would anyone mind pointing me to some tutorial or example, or better yet write a simple sample as an answer to this question? I have read this but it doesn't show an example of how to go about implementing a transformable attribute that is an NSArray. Thanks in advance!

    Read the article

  • When I select any segment in segmentControll it doesnot show highlighted

    - by rathodrc
    NSArray *itemArray = [NSArray arrayWithObjects:@"one", @"Two", @"Three", nil]; segmentControl = [[UISegmentedControl alloc] initWithItems:itemArray]; segmentControl.frame = CGRectMake(5, 5, 325, 35); segmentControl.segmentedControlStyle = UISegmentedControlStyleBar; segmentControl.tintColor = [UIColor blackColor]; [self changeUISegmentFont:segmentControl]; //[self.view addSubview:segmentControl]; self.navigationItem.titleView = segmentControl; [segmentControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged]; This is my code of segment control and my problem is .. When I select any segment it does not show me that that segment is selected.. I mean it is not shown highlighted.. can Anyone tell me what the problem is??

    Read the article

  • numeric sort with NSSortDescriptor for NSFetchedResultsController

    - by edziubudzik
    I'm trying to numerically sort data that's displayed in a UITableView. Before that I used such a sort descriptor: sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)]; now I'd like to use block to sort this numerically like this: sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES comparator:^NSComparisonResult(id obj1, id obj2) { return [((NSString *)obj1) compare:(NSString *)obj2 options:NSCaseInsensitiveSearch | NSNumericSearch]; }]; but it sorts the data incorectly causing conflict with section names in NSFetchedResultsController. So I tryed to immitate the old sorting with a comparator block - just to be sure that the problem is not caused by numeric comparison. The problem is that those lines: sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES comparator:^NSComparisonResult(id obj1, id obj2) { return [((NSString *)obj1) caseInsensitiveCompare:(NSString *)obj2]; }]; also cause the same error and I don't see why they won't sort the data in the same way the first method did... Any ideas?

    Read the article

  • Errors in UILabel

    - by Todd Davies
    I'm trying to use the FXlabel when following this (Adding a gradient label section) tutorial. This is some of the code inside my viewDidLoad method: self.logoLabel = [[FXLabel alloc] initWithFrame:CGRectMake(14, 11, 280, 87)]; [logoLabel setFont:[UIFont boldSystemFontOfSize:45]]; [logoLabel setTextColor:[UIColor whiteColor]]; [logoLabel setShadowColor:[UIColor blackColor]]; [logoLabel setShadowOffset:CGSizeMake(0, 2)]; [logoLabel setTextAlignment:UITextAlignmentCenter]; [logoLabel setBackgroundColor:[UIColor clearColor]]; [logoLabel setText:@"Attorney Biz"]; [logoLabel setGradientStartColor:[UIColor colorWithRed:163.0/255 green:203.0/255 blue:222.0/255 alpha:1.0]]; [logoLabel setGradientEndColor:[UIColor whiteColor]]; Unfortnuately, I get an error "No visible @interface for 'UILabel' declares the selector 'setGradientStartColor'" at the second-to-last line and "No visible @interface for 'UILabel' declares the selector 'setGradientEndColor'" Can somebody explain how to remove these errors?

    Read the article

  • fetchBatchSize to be same as fetchLimit

    - by user1730622
    What does it mean to have fetchBatchSize to be the same as fetchLimit, say both are set to be 5. My understanding is that, with the fetchLimit, then only 5 records will be in the fetch result set; and additionally with the fetchBatchSize, only the ids/identities of the records will be read to the memory, and then the full records won't be retrieved until they are accessed. Is that a correct understanding?

    Read the article

  • Using NSArray for C-type int comparisons

    - by Andrew Barinov
    I would like to iterate through an NSArray of ints and compare each one to a specific int. All ints are C type ints. The code I am using is as follows: -(int)ladderCalc: (NSArray*)amounts: (int)amount { int result; for (NSUInteger i=0; i< [amounts count]; i++) { if (amount < [amounts objectAtIndex:i]); { // do something } // do something } } However I get an error when comparing the int amount to the result of [amounts objectAtIndex:i] because you cannot compare id to int. Why is the id involved in this case? Shouldn't objectAtIndex just return the object at the index specified? Is it possible to cast the object returned to an C int and then do the comparison? Or should I just dispense with NSArray and do this type of thing in C?

    Read the article

  • cellForRowAtIndexPath not called for all sections

    - by Wynn
    I have a UITableView that has five sections. Just as the title describes cellForRowAtIndexPath is only being called for the first four. All connections have been made concerning the datasource and delegate. Also, my numberOfSectionsInTableView clearly returns 5. Printing out the number of sections from within cellForRowAtIndexPath shows the correct number, thus confirming that cellForRowAtIndexPath is simply not being called for all sections. What on earth is going on? I looked pretty hard for an answer to this question but could't find one. If this has already been answered please forgive me and point me in the correct direction. My cellForRowAtIndexPath: - (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [theTableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } switch (indexPath.section) { case 0: cell.textLabel.text = ticket.description; break; case 1: cell.textLabel.text = ticket.ticketStatus; break; case 2: cell.textLabel.text = ticket.priority; break; case 3: cell.textLabel.text = ticket.customerOfficePhone; break; case 4: { //This never ever gets executed Comment *comment = [ticket.comments objectAtIndex:indexPath.row]; cell.textLabel.text = comment.commentContent; break; } } return cell; } My numberOfSectionsInTableView: - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 5; } My numberOfRowsInSection: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSInteger numberOfRows; if (section == 4) { numberOfRows = [ticket.comments count]; } else { numberOfRows = 1; } return numberOfRows; } Any suggestions are appreciated. Thanks in advance.

    Read the article

  • UIView to Form Sheet flip animation rotation issue

    - by GSD
    I have this view to form sheet flip animation that works great in portrait mode but not in any other orientations. In my code, I use it with a UIView embedded in another UIView, which is in the root view. The animation will be rotated. Anyone has an idea why? - (void)presentModalViewControllerWithFlipAnimation:(UIViewController *)modalViewController fromView:(UIView *)fromView { UIWindow* window = [[UIApplication sharedApplication] windows][0]; _fromViewSnapshot = [[UIImageView alloc] initWithFrame:fromView.bounds]; UIGraphicsBeginImageContext(fromView.bounds.size); [fromView.layer renderInContext:UIGraphicsGetCurrentContext()]; [_fromViewSnapshot setImage:UIGraphicsGetImageFromCurrentImageContext()]; [_fromViewSnapshot sizeToFit]; UIGraphicsEndImageContext(); _fromViewSnapshot.autoresizesSubviews = YES; _fromViewSnapshot.frame = [fromView.superview convertRect:fromView.frame toView:window]; [window addSubview:_fromViewSnapshot]; fromView.hidden = YES; modalViewController.modalPresentationStyle = UIModalPresentationFormSheet; [self presentViewController:modalViewController animated:NO completion:nil]; UIView __weak *presentedView = modalViewController.view.superview; UIGraphicsBeginImageContext(presentedView.bounds.size); [presentedView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage* modalSnapshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); UIView __weak *presentationSuperview = presentedView.superview; [presentedView removeFromSuperview]; UIImageView* presentationSnapshotView = [[UIImageView alloc] initWithImage:modalSnapshot]; presentationSnapshotView.autoresizingMask = UIViewAutoresizingNone; [_fromViewSnapshot.superview bringSubviewToFront:_fromViewSnapshot]; [UIView animateWithDuration:kFlipAnimationScaleSpeed delay:0 options:UIViewAnimationOptionCurveEaseIn|UIViewAnimationOptionBeginFromCurrentState animations: ^{ [UIView animateWithDuration:kFlipAnimationScaleSpeed delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations: ^{ _fromViewSnapshot.frame = [_fromViewSnapshot.superview convertRect:presentedView.frame fromView:presentationSuperview]; } completion:nil]; } completion:^(BOOL finished) { [UIView setAnimationBeginsFromCurrentState:YES]; [UIView transitionWithView:_fromViewSnapshot duration:kFlipAnimationSpeed options:UIViewAnimationOptionCurveEaseIn|UIViewAnimationOptionTransitionFlipFromRight animations: ^{ presentationSnapshotView.frame = _fromViewSnapshot.bounds; [_fromViewSnapshot addSubview:presentationSnapshotView]; } completion:^(BOOL finished) { [presentationSuperview addSubview:presentedView]; [presentationSnapshotView removeFromSuperview]; [_fromViewSnapshot removeFromSuperview]; }]; }]; } - (void)dismissViewControllerWithFlipAnimation:(UIView*)fromView completion:(void (^)(void))completion { UIWindow* window = [[UIApplication sharedApplication] windows][0]; UIView __weak *presentedView = self.presentedViewController.view.superview; UIGraphicsBeginImageContext(presentedView.bounds.size); [presentedView.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage* modalSnapshot = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); [presentedView removeFromSuperview]; UIImageView* presentationSnapshotView = [[UIImageView alloc] initWithImage:modalSnapshot]; presentationSnapshotView.autoresizingMask = UIViewAutoresizingNone; presentationSnapshotView.frame = presentedView.frame; [window addSubview:presentationSnapshotView]; [UIView animateWithDuration:kFlipAnimationScaleSpeed delay:0 options:UIViewAnimationOptionCurveEaseIn|UIViewAnimationOptionBeginFromCurrentState animations: ^{ [UIView animateWithDuration:kFlipAnimationScaleSpeed delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations: ^{ presentationSnapshotView.frame = [fromView.superview convertRect:fromView.frame toView:window]; } completion:nil]; } completion:^(BOOL finished) { [UIView setAnimationBeginsFromCurrentState:YES]; [UIView transitionWithView:presentationSnapshotView duration:kFlipAnimationSpeed options:UIViewAnimationOptionCurveEaseIn|UIViewAnimationOptionTransitionFlipFromLeft animations: ^{ _fromViewSnapshot.frame = presentationSnapshotView.bounds; [presentationSnapshotView setImage:[(UIImageView*)_fromViewSnapshot image]]; [self dismissViewControllerAnimated:NO completion:nil]; } completion:^(BOOL finished) { [presentationSnapshotView removeFromSuperview]; _fromViewSnapshot = nil; completion(); }]; }]; }

    Read the article

  • Get nul value from one ViewController to one ViewController

    - by sovannarith
    I have 2 ViewControllers namely V1 and V2. I want to pass value from V2 to V1 but I get value 0 for countV1 in V1. I saw more questions in stackoverflow but I can't deal with this small problem. I use ARC. In V1 .h file @property(nonatomic,unsafe_unretained) int countV1; .m file @synthesize countV1; In V2 .m file int countV2 = 1; V1 *v1 = [V1 alloc] initWithNibName:@"V1" bundle:nil]; v1.countV1 = countV2;

    Read the article

  • Split screen in iPad

    - by AAT
    I working on a iPAD only app which requires me to split the screen such a way that: (1) there are 2 parts on the screen divided vertically (2) On the left side, user can communicate using a chat (3) On the right side, user can see continuous streaming data I am not sure (A) how can I do two tasks simultaneously (B)how to split the screen (is Split view the way to achieve both of these?) Thank you.

    Read the article

  • Correcting a plist with dictionaries

    - by ingenspor
    Plist is copyed to documents directory if it doesn't exist. If it already exists, I want to use the "Name" key from NSDictionary in bundleArray to find the matching NSDictionary in documentsArray. When the match is found, I want to check for changes in the strings and replace them if there is a change. If a match is not found it means this dictionary must be added to documents plist. This is my code: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self managePlist]; return YES; } - (void)managePlist { NSError *error; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"Objects.plist"]; NSString *bundle = [[NSBundle mainBundle] pathForResource:@"Objects" ofType:@"plist"]; NSFileManager *fileManager = [NSFileManager defaultManager]; if (![fileManager fileExistsAtPath: path]) { [fileManager copyItemAtPath:bundle toPath:path error:&error]; } else { NSArray *bundleArray = [[NSArray alloc] initWithContentsOfFile:bundle]; NSMutableArray *documentArray = [[NSMutableArray alloc] initWithContentsOfFile:path]; BOOL updateDictionary = NO; for(int i=0;i<bundleArray.count;i++) { NSDictionary *bundleDict=[bundleArray objectAtIndex:i]; BOOL matchInDocuments = NO; for(int ii=0;ii<documentArray.count;ii++) { NSMutableDictionary *documentDict = [documentArray objectAtIndex:ii]; NSString *bundleObjectName = [bundleDict valueForKey:@"Name"]; NSString *documentsObjectName = [documentDict valueForKey:@"Name"]; NSRange range = [documentsObjectName rangeOfString:bundleObjectName options:NSCaseInsensitiveSearch]; if (range.location != NSNotFound) { matchInDocuments = YES; } if (matchInDocuments) { if ([bundleDict objectForKey:@"District"] != [documentDict objectForKey:@"District"]) { [documentDict setObject:[bundleDict objectForKey:@"District"] forKey:@"District"]; updateDictionary=YES; } } else { [documentArray addObject:bundleDict]; updateDictionary=YES; } } } if(updateDictionary){ [documentArray writeToFile:path atomically:YES]; } } } If I run my app now I get this message: '-[__NSCFDictionary setObject:forKey:]: mutating method sent to immutable object' How can I fix this? When this is fixed, do you think my code will work? If not, I would be happy for some suggestions on how to do this. I have struggled for a while and really need to publish the update with the corrections! Thanks a lot for your help.

    Read the article

  • Show and Fade UIImageView after 2 Seconds

    - by user1536432
    I am working on a notification system in my iPhone game and want an image to pop up on the screen and automatically fade after 2 seconds. User clicks a button that calls the method "popupImage" An image appears on the screen in a designated spot, it doesn't need to fade in The image fades out by itself after being on the screen for 2 seconds. Is there any way of doing this? Thanks ahead of time.

    Read the article

  • cellForRowAtIndexPath not being called, but rowsInSections is and it's delegate is set

    - by Jhorra
    I searched around prior to posting this and made sure I hadn't missed anything obvious, though I have a feeling I am missing something basic. I'm using this as a sidebar navigation view. I tried making them static cells and pre-populating them, but they were blank that way as well. When I do it this way I can see everything gets called except that. I've tried deleting it and re-adding it. #import "acxSideBarController.h" @interface acxSideBarController () @end @implementation acxSideBarController @synthesize sidebarDelegate = _sidebarDelegate; - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; if ([self.sidebarDelegate respondsToSelector:@selector(lastSelectedIndexPathForSidebarViewController:)]) { NSIndexPath *indexPath = 0; [self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone]; } self.tableView.backgroundColor = [UIColor underPageBackgroundColor]; self.tableView.dataSource = self; self.tableView.delegate = self; } - (void)viewDidUnload { [super viewDidUnload]; } - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return (interfaceOrientation == UIInterfaceOrientationPortrait); } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 3; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if(section == 0) return 2; else if(section == 1) return 1; else return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"linkCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } NSString *name = @""; if(indexPath.section == 1) name = @"Inbox"; else if(indexPath.section == 2) name = @"Logout"; else { if(indexPath.row == 0) name = @"Roster"; else if(indexPath.row == 1) name = @"Environmental Variables"; } cell.textLabel.text = name; cell.textLabel.textColor = [UIColor darkTextColor]; return cell; } - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { if(section == 0) return @"Students"; else if(section == 1) return @"Communication"; else return @" "; } #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (self.sidebarDelegate) { [self.sidebarDelegate acxSideBarController:self atIndexPath:indexPath]; } } @end If it's helpful here's the header file #import <UIKit/UIKit.h> @protocol acxSideBarControllerDelegate; @interface acxSideBarController : UITableViewController @property (nonatomic, assign) id <acxSideBarControllerDelegate> sidebarDelegate; @end @protocol acxSideBarControllerDelegate <NSObject> - (void)acxSideBarController:(acxSideBarController *)acxSideBarController atIndexPath:(NSIndexPath *)indexPath; @optional - (NSIndexPath *)lastSelectedIndexPathForacxSideBarController:(acxSideBarController *)acxSideBarController; @end

    Read the article

  • How to fix a slow scrolling table view

    - by hanumanDev
    I have a table view that's scrolling slowly. Does anyone know why that might be? There is an image for each row, but even after the images are loaded it still stutters and scrolls slowly. thanks for any help here's my code: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *simpleTableIdentifier = @"SimpleTableCell"; SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier]; if (cell == nil) { NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil]; cell = [nib objectAtIndex:0]; } // Get item from tableData NSDictionary *item = (NSDictionary *)[displayItems objectAtIndex:indexPath.row]; // display the youdeal deal image photoString = [item objectForKey:@"image"]; UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:photoString]]]; cell.titleLabel.text = [item objectForKey:@"supercat"]; cell.descriptionLabel.text = [item objectForKey:@"title"]; NSString *convertedLeftCount = [NSString stringWithFormat:@"%@",[item objectForKey:@"left_count"]]; cell.amountLabel.text = convertedLeftCount; cell.thumbnailImageView.image = image; cell.priceLabel.text = [item objectForKey:@"cat"]; return cell; }

    Read the article

  • iAd banner gives warning when pushed off screen by navController

    - by James Dunay
    I have a iAd that seems to be correctly displaying but when push a new view controller into the view i get a warning from the iAd that says it has been: WARNING A banner view (0x490fd0) has an ad but may be obscured. This message is only printed once per banner view. But the ad still runs fine so should i pay attention to this? I just tried adding self.adBannerView = nil; [adBannerView release];` just before i push the viewController but i still get that error

    Read the article

< Previous Page | 63 64 65 66 67 68 69 70 71 72 73 74  | Next Page >