Search Results

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

Page 75/151 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • How can I get the JSON array data from nsstring or byte in xcode 4.2?

    - by user1471568
    I'm trying to get values from nsdata class and doesn't work. here is my JSON data. { "count": 3, "item": [{ "id": "1", "latitude": "37.556811", "longitude": "126.922015", "imgUrl": "http://175.211.62.15/sample_res/1.jpg", "found": false }, { "id": "3", "latitude": "37.556203", "longitude": "126.922629", "imgUrl": "http://175.211.62.15/sample_res/3.jpg", "found": false }, { "id": "2", "latitude": "37.556985", "longitude": "126.92286", "imgUrl": "http://175.211.62.15/sample_res/2.jpg", "found": false }] } and here is my code -(NSDictionary *)getDataFromItemList { NSData *dataBody = [[NSData alloc] initWithBytes:buffer length:sizeof(buffer)]; NSDictionary *iTem = [[NSDictionary alloc]init]; iTem = [NSJSONSerialization JSONObjectWithData:dataBody options:NSJSONReadingMutableContainers error:nil]; NSLog(@"id = %@",[iTem objectForKey:@"id"]); //for Test output = [[NSString alloc] initWithBytes:buffer length:rangeHeader.length encoding:NSUTF8StringEncoding]; NSLog(@"%@",output); return iTem; } how can I access every value in the JSON? Please help me.

    Read the article

  • swipe to delete uitableview cell; a bit jumpy?

    - by Veeru
    I have implemented "swipe to delete" on my table cell. It works fine, how ever, the delete button is a little jumpy; as in, i really have to position my finger on top of the button and carefully touch it to delete the record. I am not sure if am making it clear; let me do my best to explain When the delete button appears; the user has trouble clicking on it, it disappears the moment its clicked. THe user has to try a few times to actually delete the cell. Am not sure what the reason is, it just seems like the delete button gets hidden as though the user has clicked on a different part of the cell. Any suggestsions?

    Read the article

  • How to create a numbered bullet not in UIwebview but using UItextview

    - by Raviraj Peerbits II
    The format is similar to below text: 1. I need to create the bullet like this which would be helpful to me in my application and need someone to you to share the code with me. 2. Can you help me out and remember the UIwebview is not preferable because i dont have to execute the webviewwillload method. 3. Please find the best and easy way to approach this. 4. Also remember there should be indent spacing. Thanks in advance and its urgent for me.

    Read the article

  • Passing a NSString to another ViewController using classes

    - by Jeff Kranenburg
    I know this insanely simple, but I am re-teaching myself the basics and trying to get my head around this:-) I have one ViewController called MainVC and I have one called ClassVC In ClassVC I have this code: @interface ClassVC : UIViewController { NSString *mainLine; } @property (nonatomic, retain) NSString *mainLine; @end and I have this in the implementation file: @synthesize mainLine = _mainLine; -(NSString *)_mainLine { _mainLine = @"This a string from a Class"; return _mainLine; } Now I was thinking that if I #import the ClassVC into MainVC I would be able to transfer that string along as well like so: This code is in the viewDidLoad _mainLabel.text = _secondClass.mainLine; NSLog(@"%@", _secondClass.mainLine); But that is not working - so cannot I not pass strings in through this way???

    Read the article

  • SLRequest return nil before block complete

    - by jaytr0n
    I'm having a little trouble thinking through this and deciding if it's a design flaw on my behalf or if I'm missing a piece that could make this work. Basically I'm using the new SLRequest to make a Twitter API call. After the data is returned, I'd like to put it into an object and return that object: -(AUDSlide *) getFollowerSlide { SLRequest *getRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:[NSURL URLWithString:[NSString stringWithFormat:@"https://api.twitter.com/1.1/followers/ids.json?user_id=%@", [[self.twitterAccount valueForKey:@"properties"] valueForKey:@"user_id"]]] parameters:nil]; getRequest.account = twitterAccount; AUDSlide *slide = [[AUDSlide alloc] init]; [getRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { if ([urlResponse statusCode] == 200) { NSError *jsonError = nil; NSDictionary *list = [NSJSONSerialization JSONObjectWithData:responseData options:0 error:&jsonError]; NSLog(@"Number of Followers: %u", [[list objectForKey:@"ids"] count]); slide.title = @"Followers"; slide.number = [NSString stringWithFormat:@"%u",[[list objectForKey:@"ids"] count]]; } else{ slide.title = @"Error"; slide.number = [NSString stringWithFormat: @"E%u", [urlResponse statusCode]]; } }]; return slide; } Of course the slide is returned before the call is complete and returns a nil object. So I'm not sure if I should try to force this into a synchronous request (that seems like it could be a bad idea) or rethink the design. Does anyone have any advice?

    Read the article

  • UITableView with multiple selections

    - by NewDev
    I have a UITableView with multiple selections enabled. If I select items and scroll the list back and forth they are remembered and shown and selected (blue background). Using the didDeselectRowAtIndexPath and didSelectRowAtIndexPath I am able to keep my own array of selected items. That part works well. However, if I then use the sectionForSectionIndexTitle and jump to a letter, the selection appears to be forgotten - even indexPathForSelectedRows appears to have been reset and is now empty. My own array remembers that an item is selected and I can set the cell.selected in the cellForRowAtIndexPath but the instant I move the list it is forgotten again. Any ideas? Is this a bug, or how do you retain the selection list when jumping to a letter?

    Read the article

  • two view controllers and reusability with delegate

    - by netcharmer
    Newbie question about design patterns in objC. I'm writing a functionality for my iphone app which I plan to use in other apps too. The functionality is written over two classes - Viewcontroller1 and Viewcontroller2. Viewcontroller1 is the root view of a navigation controller and it can push Viewcontroller2. Rest of the app will use only ViewController1 and will never access Viewcontroller2 directly. However, triggered by user events, Viewcontroller2 has to send a message to the rest of the app. My question is what is the best way of achieving it? Currently, I use two level of delegation to send the message out from Viewcontroller2. First send it to Viewcontroller1 and then let Viewcontroller1 send it to rest of the app or the application delegate. So my code looks like - //Viewcontroller1.h @protocol bellDelegate -(int)bellRang:(int)size; @end @interface Viewcontroller1 : UITableViewController <dummydelegate> { id <bellDelegate> delegate; @end //Viewcontroller1.m @implementation Viewcontroller1 -(void)viewDidLoad { //some stuff here Viewcontroller2 *vc2 = [[Viewcontroller2 alloc] init]; vc2.delegate = self; [self.navigationController pushViewController:vc2 animated:YES]; } -(int)dummyBell:(int)size { return([self.delegate bellRang:size]); } //Viewcontroller2.h @protocol dummyDelegate -(int)dummyBell:(int)size; @end @interface Viewcontroller2 : UITableViewController { id <dummyDelegate> delegate; @end //Viewcontroller2.m @implementation Viewcontroller2 -(int)eventFoo:(int)size { rval = [self.delegate dummyBell:size]; } @end

    Read the article

  • save UIImageView state & the save the Entire View

    - by adamprocter
    I have an iPad app where you add photos to a page. I then want to save the photos positions, then add further pages with more photo positions and eventually save all the pagesto be looked at later in a slideshow style. Can anyone advise 1. Saving UIImageView states when moving to new views (or swapping views) - I see this on using NSCoding iPhone - save UIImageView state - but am at a lose - any more examples ? 2. How to save the 'entire' set of view to look at later (like a slideshow) - no idea on where to start with this ? array ? coredata ? Thanks

    Read the article

  • How to obtain cocos2d-x 3.1 templates into XCode 5.x?

    - by Mayerz
    I cloned Cocos2d-x repo from github, everything works fine but I can't find how to install the Cocos2d templates into XCode. I saw that people were used to use this file, located at the root of the repo: ./install-templates-xcode.sh -f -u but it looks like this script file has been removed, any help appreciated. edit: Still no answer to this problem, even the slightest clues could help me. Are there still templates for XCode? Couldn't get answers from #cocos2d-x irc

    Read the article

  • UIView fine for iPhone 4in, but squashed in iPhone 3.5in

    - by coopersita
    I started a new project in the new Xcode, and I see that my default the main window is set to 320x548. I'm fine with that, but when I test my app, a view I added to my main xib, which is supposed to be 280x280, looks more like 280x200 when testing on 3.5in devices. I've tried changing the settings for that view in the xib, but nothing seems to affect it. How do I ensure background compatibility so that in older devices the view is the same size?

    Read the article

  • Save Values AUTOMATICALLY with NSUserDefaults

    - by Edouard Tarter
    I have an app with two UITextFields, where the user enters an integer, and then a method is called with the values the user enters. But when I completely close the app, the values are deleted. I want to change it to save the value the user entered when it closes, and loads it up when the app is re-opened. I tried this with NSUserDefault, and it worked fine (with save and load button), but I want it to make it automatically, without pressing any buttons. I saw some other people do it with the basic methods in the AppDelegate.m, but I don't know anything about that, therefore I didn't understand it at all. I saw MANY tutorials online, but I didn't understand any of them, please help, and give a detailed answer, thanks :)

    Read the article

  • best way to use CoreLocation across multiple views

    - by Matt
    I have two views in my app, one is a general view where CoreLocation works away calculating the users location while the user is doing other stuff in the view. The second view is accessed by the user when they touch a button allowing them to locate themselves more accurately using a mapview and MapKit, i would like the mapview in this view to show the location that CoreLocation has already identified in the first view AND to continue displaying this location based on updates from CoreLocation in the other view. Is the best way here to create a singleton that encapsulates the CoreLocation stuff and have this referenced in the view with the map, or to use notifications ? or to use some other better practice for my scenario ? Thanks

    Read the article

  • Placing text on UIView in custom location

    - by JAM
    I am trying to calculate a position to place label on the screen. The goal is to place "word" label in lower right corner of the first square block If yellowish square is defined as myView = [[UIView alloc] initWithFrame:CGRectMake(100, 100, 70, 70)]; [self.view addSubview:myView]; [myView setBackgroundColor:[UIColor colorWithHexString:@"FFFFEC"]]; Using it, i'd like to place a label in it's lower right corner l1 = [[UILabel alloc] init]; [l1 setText:@"word"]; [l1 setFrame:CGRectMake(myView.frame.origin.x + myView.frame.size.width, myView.frame.origin.y + myView.frame.size.height, 700, 700)]; [l1 setFont:[UIFont fontWithName:@"Arial" size:10.0]]; [l1 setBackgroundColor:[UIColor colorWithHexString:@"CCFFFEC"]]; [l1 setTextAlignment:UITextAlignmentRight]; [l1 sizeToFit]; This is what happens: The matter here obviously, is in a correct offset. Knowing the font and size of text, how can one correctly calculate it?

    Read the article

  • Objective C - creating concrete class instances from base class depending upon type

    - by indiantroy
    Just to give a real world example, say the base class is Vehicle and concrete classes are TwoWheeler and FourWheeler. Now the type of the vehicle - TwoWheeler or FourWheeler, is decided by the base class Vehicle. When I create an instance of TwoWheeler/FourWheeler using alloc-init method, it calls the super implementation like below to set the value of common properties defined in the Vehicle class and out of these properties one of them is type that actually decides if the type is TwoWheeler or FourWheeler. if (self = [super initWithDictionary:dict]){ [self setOtherAttributes:dict]; return self; } Now when I get a collection of vehicles some of them could be TwoWheeler and others will be FourWheeler. Hence I cannot directly create an instance of TwoWheeler or FourWheeler like this Vehicle *v = [[TwoWheeler alloc] initWithDictionary:dict]; Is there any way I can create an instance of base class and once I know the type, create an instance of child class depending upon type and return it. With the current implementation, it would result in infinite loop because I call super implementation from concrete class. What would be the perfect design to handle this scenario when I don't know which concrete class should be instantiated beforehand?

    Read the article

  • how to clear a data in tableviewcell again start reload?

    - by Ios_learner
    i'm developing a bluetooth apps.1) I want to hide a tableview when i start the apps..after i pressed a action button i want to enable a tableview.. 2)if i again press a action button means tableviewcell clear the data and show empty before searching..give me an idea.. some of the code- - (IBAction)connectButtonTouched:(id)sender { [self.deviceTable reloadData]; self.connectButton.enabled = YES; [self.deviceTable reloadData]; peripheralManager = [[PeripheralManager alloc] init]; peripheralManager.delegate = self; [peripheralManager scanForPeripheralsAndConnect]; [self.deviceTable reloadData]; [NSTimer scheduledTimerWithTimeInterval:(float)5.0 target:self selector:@selector (connectionTimer:) userInfo:nil repeats:YES]; alert=[[UIAlertView alloc] initWithTitle:@"Bluetooth" message:@"Scanning" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; UIActivityIndicatorView *progress=[[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 50, 30, 30)]; [alert addSubview:progress]; [progress startAnimating]; [alert show]; } tableview -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [device count]; } -(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]; } cell.textLabel.text=[device objectAtIndex:indexPath.row]; cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton; return cell; } TableView Delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell=[tableView cellForRowAtIndexPath:indexPath]; [self performSegueWithIdentifier:@"TableDetails" sender:tableView]; }

    Read the article

  • Objective C convention: When to use For and when to use With

    - by Howard
    According to the Apple guideline , seems it is confusing, e.g. for method viewWithTag In Java, I would have a method called getViewByTag // Java version, equivalent to viewWithTag in Obj-C But I also found there are some method like objectForKey, so why not just use objectWithKey instead? getObjectByKey or just get // Java version, equivalent to objectForKey, // but why not objectWithKey? Or not viewForKey above?

    Read the article

  • UIView rotate and than move

    - by user1790354
    I have problem with rotating and moving image (UIView). If I use this for rotate: [UIView beginAnimations: @"rotate" contex: nil]; [UIView setAnimationDuration: 1]; [UIView setAnimationBeginsFromCurrentState: YES]; [UIView setAnimationCurve: UIViewAnimationCurveLinear]; spaceShip.transform = CGAffineTransformMakeRotation (angle); // spaceShip is the UIView [UIView commitAnimations]; And this to move: [UIView beginAnimations: @"move" contex: nil]; [UIView setAnimationDuration: 1]; [UIView setAnimationBeginsFromCurrentState: YES]; [UIView setAnimationCurve: UIViewAnimationCurveLinear]; spaceShip.center = destanation // destanation is a point where user tap [UIView commitAnimations]; It's working well one at a time. But together this two animations don't work. Space Ship is rotating, but does not move in direction. Where my mistake? P.S. Early I have specify anchor point (0.5, 0.5). But when I rotate image it coordinates is changing.

    Read the article

  • How can I get back into my main processing thread?

    - by daveomcd
    I have an app that I'm accessing a remote website with NSURLConnection to run some code and then save out some XML files. I am then accessing those XML Files and parsing through them for information. The process works fine except that my User Interface isn't getting updated properly. I want to keep the user updated through my UILabel. I'm trying to update the text by using setBottomBarToUpdating:. It works the first time when I set it to "Processing Please Wait..."; however, in the connectionDidFinishLoading: it doesn't update. I'm thinking my NSURLConnection is running on a separate thread and my attempt with the dispatch_get_main_queue to update on the main thread isn't working. How can I alter my code to resolve this? Thanks! [If I need to include more information/code just let me know!] myFile.m NSLog(@"Refreshing..."); dispatch_sync( dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [self getResponse:@"http://mylocation/path/to/file.aspx"]; }); [self setBottomBarToUpdating:@"Processing Please Wait..."]; queue = dispatch_queue_create("updateQueue", DISPATCH_QUEUE_CONCURRENT); connectionDidFinishLoading: if ([response rangeOfString:@"Complete"].location == NSNotFound]) { // failed } else { //success dispatch_async(dispatch_get_main_queue(),^ { [self setBottomBarToUpdating:@"Updating Contacts..."]; }); [self updateFromXMLFile:@"http://thislocation.com/path/to/file.xml"]; dispatch_async(dispatch_get_main_queue(),^ { [self setBottomBarToUpdating:@"Updating Emails..."]; }); [self updateFromXMLFile:@"http://thislocation.com/path/to/file2.xml"]; }

    Read the article

  • Why I can not find my Iphone device in xcode

    - by itenyh
    I have added my iphone as device and associate it with provisioning. Then I download the newest provisioning and install it (I have successed added ipad as test device before). Now, in the "Organizer", I can see the iphone device but when I connect iphone device I can not find the iphone device to run my app. My software version is 4.2.1, is it the version not the latest that lead to this problem? Or what is the possible reason?

    Read the article

  • Why won't my movie play using MPMoviePlayerController?

    - by Nosrettap
    I'm trying to get a basic movie to play in an iPhone app; however, I can't seem to get it to work. Here's my entire code: #import <MediaPlayer/MediaPlayer.h> #import "ViewController.h" @implementation ViewController - (IBAction)playMoviePressed:(id)sender { NSURL *url = [NSURL URLWithString:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"]; MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:moviePlayer]; moviePlayer.controlStyle = MPMovieControlStyleDefault; moviePlayer.shouldAutoplay = YES; [self.view addSubview:moviePlayer.view]; [moviePlayer setFullscreen:YES animated:YES]; [moviePlayer prepareToPlay]; [moviePlayer play]; } @end I have one button on screen that calls playMoviePressed when it is tapped. I know that this method is getting called. I have also tried this with .mov and .mp4 local files that I have dragged into xcode.

    Read the article

  • Core Data to-many relationship in code

    - by Jan Bezemer
    I have three entities: Session, User and Test. A session has 0-many users and a user can perform 0-6 tests. (I say 0 but in the real application always at least 1 is required, at least 1 user for a session and at least 1 test for a user. But I say 0 to express an empty start.) All entities have their own specific data attributes too. A user has a name, A session has a name, a test has six values to be filled in by the user, and so on. But my issue is with the relationships. How do I set multiple users and have them added to one session (same goes for multiple tests for one user). How do I show the content in a right way? How do I show a session that has multiple users and these users having completed multiple tests? Here's my code so far with regard to issue 1: Session *session = [NSEntityDescription insertNewObjectForEntityForName:@"Session" inManagedObjectContext:context]; session.name = @"Session 1"; User *users = [NSEntityDescription insertNewObjectForEntityForName:@"User" inManagedObjectContext:context]; users.age = [NSNumber numberWithInt:28]; users.session = session; //sessie.users = users; [sessie addUserObject:users]; With regard to issue 2: I can log the session, but I can't get the user(s) logged from a session. NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Session" inManagedObjectContext:context]; [fetchRequest setEntity:entity]; NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error]; for (Session *info in fetchedObjects) { NSLog(@"Name: %@", info.name); NSLog(@"Having problems with this: %@",info.user); //User *details = info.user; //NSLog(@"User: %@", details.age); }

    Read the article

  • How to use Devicemotion/Gyroscope to move a dot from center to 8 directions of iphone screen

    - by iSeeker
    I am trying to move a dot at center to 8 directions of iphone screen using Devicemotion such that it moves faster when tilted at a faster rate. Rough sketch is below: I could find a similar implementation in an app called Gyrododge in appstore, i cant figure out how to make it work... Update: This is what i have done so far, but the response is not smooth, and is very jittery.. xdiff and ydiff are the change of device attitude in x and y directions, derived from quatenion implementation. if (currDeviceMotion.rotationRate.x < -2) { NSLog(@"To Top"); if (195+800*ydiff >=193 && 195+800*ydiff <= 197) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (195+800*ydiff >=390 ) { [self.pitchDot setFrame:CGRectMake(150, 390, 20, 20)]; }else if (195+800*ydiff <= 0){ [self.pitchDot setFrame:CGRectMake(150, 0, 20, 20)]; }else if(195+800*ydiff < 194){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; }else if(195+800*ydiff > 196){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x > 2){ NSLog(@"To Bottom"); if (195+800*ydiff >=193 && 195+800*ydiff <= 197) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (195+800*ydiff >=390 ) { [self.pitchDot setFrame:CGRectMake(150, 390, 20, 20)]; }else if (195+800*ydiff <= 0){ [self.pitchDot setFrame:CGRectMake(150, 0, 20, 20)]; }else if(195+800*ydiff < 194){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; }else if(195+800*ydiff > 196){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.y < -2){ NSLog(@"To Left"); if (150+500*xdiff >= 148 && 150+500*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+500*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 195, 20, 20)]; }else if (150+500*xdiff <= 0){ [self.pitchDot setFrame:CGRectMake(0, 195, 20, 20)]; }else if(150+500*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; }else if(150+500*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.y > 2){ NSLog(@"To Right"); if (150+500*xdiff >= 148 && 150+500*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+500*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 195, 20, 20)]; }else if (150+500*xdiff <= 0){ [self.pitchDot setFrame:CGRectMake(0, 195, 20, 20)]; }else if(150+500*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; }else if(150+500*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x < -0.20 && currDeviceMotion.rotationRate.y > 0.20 ){ NSLog(@"To Diagonal Right Top"); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 0, 20, 20)]; }else if(150+650*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195-1.3*650*xdiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x > 0.20 && currDeviceMotion.rotationRate.y < -0.20 ){ NSLog(@"To Diagonal Left Bottom"); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff <= 0 ) { [self.pitchDot setFrame:CGRectMake(0, 390, 20, 20)]; }else if(150+650*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195-1.3*650*xdiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x < -0.20 && currDeviceMotion.rotationRate.y < -0.20 ){ NSLog(@"To Diagonal Left Top and xdiff is %f",xdiff); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff <= 0 ) { [self.pitchDot setFrame:CGRectMake(0, 0, 20, 20)]; }else if(150+650*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195+1.3*650*xdiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x > 0.20 && currDeviceMotion.rotationRate.y > 0.20 ){ NSLog(@"To Diagonal Right Bottom"); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 390, 20, 20)]; }else if(150+650*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195+1.3*650*xdiff, 20, 20)]; } } }else if((currDeviceMotion.rotationRate.x < 0.20 && currDeviceMotion.rotationRate.x < -0.20) ||(currDeviceMotion.rotationRate.y < 0.20 && currDeviceMotion.rotationRate.y < -0.20) ||(currDeviceMotion.rotationRate.z < 0.20 && currDeviceMotion.rotationRate.z < -0.20)){ [self.rollDot setFrame:CGRectMake(150, 195, 20, 20)]; [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; } It could be great if i could make it move like the application i have stated above, called Gyrododge This link also addresses a similar question:Link. Any advice or help is greatly appreciated... Thanks.

    Read the article

  • How to iterate & retrieve values from NSArray of NSArrays of NSDictionaries

    - by chinjazz
    I'm stumpped on how iterate and get values for an Array of Arrays of NSDictionaries (different classes/entities). Here's what I'm currently doing: 1) Constructing two separate arrays of NSDictionaries (different entities) 2) Combining both arrays with: NSMutableArray *combinedArrayofDicts = [[NSMutableArray alloc] initWithObjects: sizesArrayOfDicts, wishListArrayOfDicts , nil]; 3) Then archive combinedArrayofDicts : NSData *dataToSend = [NSKeyedArchiver archivedDataWithRootObject:combinedArrayofDicts]; 4) Transmit over GameKit [self.session sendDataToAllPiers:dataToSend withDataMode: GKSendDataReliable error:nil]; 5) How would I manage traversing thru this array on the receiving end? I want to fetch values by for each class which is key'ed by classname: Here's how it looks via NSLog (2 Sizes Dicts, and 1 Wishlist Dict) Printing description of receivedArray: <__NSArrayM 0xbc65eb0>( <__NSArrayM 0xbc651f0>( { classname = Sizes; displayOrder = 0; share = 1; sizeType = Neck; value = "13\" or 33 (cm)"; }, { classname = Sizes; displayOrder = 0; share = 1; sizeType = Sleeve; value = "34\" or 86 (cm)"; } ) , <__NSArrayM 0xbc65e80>( { classname = Wishlist; detail = ""; displayOrder = 0; imageString = ""; latitude = "30.33216666666667"; link = "http://maps.google.com/maps?q=loc:30.332,-81.41"; longitude = "-81.40949999999999"; name = bass; share = 1; store = ""; } ) ) (lldb) In my for loop I'm issuing this: NSString *value = [dict objectForKey:@"classname"]; and get an exception: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0xbc651f0' Is this frowned upon as far as mixing object types in arrays of arrays?

    Read the article

  • Passing data from one viewcontroller to another

    - by user1392515
    I subclassed two view controllers. The first one is supposed to pass data, a NSUrl object to the second one. .m of the first one: NSURL *temp = [NSURL URLWithString:@"http://example.com"]; UIViewController *presentationsFullScreen_ViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"PresentationsFullScreen_ViewController"]; presentationsFullScreen_ViewController.urlToUse = temp; .h of the second one: #import <UIKit/UIKit.h> @interface PresentationsFullScreen_ViewController : UIViewController { NSURL *urlToUse; } @property (nonatomic,retain) NSURL *urlToUse; It is obviously not working and not compiling,telling me essentially that I didn't subclass it and that the property urlToUse is not found on UIViewController. How do I subclass correctly? Thanks!

    Read the article

  • UITextField in UITableViewCell Help

    - by W Dyson
    Hello All, I have scoured the internet looking for a good tutorial or posting about having a UITableView populated with a UITextField in each cell for data entry. I want to keep track of each UITextField and the text written within it while scrolling. The tableView will be sectioned. I have been using a custom UITableViewCell but I'm open to any method. Also, is it possible to use the textFields as ivars? If any of you could point me in the right direction, it would be greatly appreciated. Thank you in advance!

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >