Search Results

Search found 1263 results on 51 pages for 'retain'.

Page 12/51 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • iPhone - a question about @property

    - by Roger
    Hi, I am kind of newbie on Objective-C and I was looking at a code, trying to understand a few things, and I come across with this .h file: there was a declaration like that on the @interface section MyVideoClass *contrast_; then below we have @property (nonatomic, retain) MyVideoClass *contrast; @property (nonatomic, retain) FetchClass *fetchMe; The strange part is that the first has an underscrore after the name and the second one, doesn't. The other strange thing is that the guy has a call to these properties like this: FetchClass *fetchOne = [self.fetchMe contrast]; What kind of call is that? This seems pretty insane to me. I simply cannot understand what is going on here, but the code works. pretty insane. Can you guys explain me that? Forgive the stupid question, but I am still learning... thanks

    Read the article

  • iPhone SDK 3.0 deprecation of UITableViewCell .text

    - by djt9000
    Came across an SDK3.0 deprecation that I am having a bit of trouble tryinig to figure out. If my declaration of @property (nonatomic, retain) UIImage *rowImage; does not work, nor @property (nonatomic, readonly, retain) UIImage *rowImage; and I @synthesize rowImage; Do I need to write my own setter because @synthesize will not properly handle this? cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:RootViewControllerCell] autorelease]; // Dpericated in SDK 3.0 // //cell.text = controller.title; //cell.image = controller.rowImage; // Using what the documentation says to use Error=== cell.textLabel = controller.title; Error=== cell.imageView = controller.rowImage; Error: Object cannot be set - Either readonly property or no setter found. Hope this makes sense, any help would be appreciated.

    Read the article

  • should variable be retained or not? iphone-sdk

    - by psebos
    Hi, in the following piece of code I got from a book. The NSString *pPath which is defined in the class as an instance variable. @interface MainViewController : UIViewController { NSString *pPath; } In the implementation after being set it is being retained. I assume that with the assignment the object is automatically retained (because it is an NSString) and there is no need to additionally retain it. - (void) initPrefsFilePath { NSString *documentsDirectory = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; pPath = [documentsDirectory stringByAppendingPathComponent: @"flippingprefs.plist"]; [pPath retain]; }

    Read the article

  • Is the scope of what Xcode's "Build and Analyze" will catch as a leak supposed to be this limited?

    - by Ranking Stackingblocks
    It doesn't care about this: NSString* leaker() { return [[NSString alloc] init]; } I thought it would have been smart enough to check if any code paths could call that function without releasing its return value (I wouldn't normally code this way, I'm just testing the analyzer). It reports this as a leak: NSString* leaker() { NSString* s = [[NSString alloc] init]; [s retain]; return s; } but NOT this: NSString* leaker() { NSString* s = [[NSString alloc] init]; // [s retain]; return s; } which seems particularly weak to me. Does it only analyze within the local scope? If the tool can't pick up on things like this, how can I expect it to pick up on actual mistakes that I might make?

    Read the article

  • @property, ok in this situation?

    - by fuzzygoat
    I am still finding my feet with objective-c and was wondering if its acceptable to use @property on the two objects below. #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface MapViewController : UIViewController <MKMapViewDelegate, CLLocationManagerDelegate> { CLLocationManager *locationManager; IBOutlet MKMapView *googleMapView; } @property(nonatomic, retain) CLLocationManager *locationManager; @property(nonatomic, retain) MKMapView *googleMapView; @end One of my reasons for using them is so that I can use the setters in my viewDidUnload, I seem to be using @property a lot and was just wondering if the use in this situation is acceptable? -(void)viewDidUnload { [self setLocationManager:nil]; [self setGoogleMapView:nil]; [super viewDidUnload]; } much appreciated Gary

    Read the article

  • Autorelease and properties

    - by ganuke
    I have few questions to ask about the following class #import <Cocoa/Cocoa.h> @interface SomeObject { NSString *title; } @property (retain) NSString *title; @end implementation SomeObject @synthesize title; -(id)init { if (self=[super init]) { self.title=[NSString stringWithFormat:@"allyouneed"]; } return self; } -(void)testMethod{ self.title=[[NSString alloc] init] ; } -(void)dealloc { self.title=nil; [super dealloc]; } In the .h file do we need to declare the title and sub when we add the property. is it not enough to add the @property (retain) NSString *title; line. 2.Do i need to autorelease both assignment to title in the init and testMethod. if So why? Can some one explain these things to me.

    Read the article

  • Detect if NSString contains a URL and generate a "link" to open inside the app a Safari View

    - by Cy
    I have am reading a twitter feed in my iPhone application and can do it correctly, but I'd like to evolve it in a way to detect if the whole NSString contains any URL or URLs and create a "link" that will open a UIWebView within the same application. Can you guide me on how to perform this task? -(void) setTextTwitter:(NSString *)text WithDate:(NSString*)date { [text retain]; [textTwitter release], textTwitter = nil; textTwitter = text; [date retain]; [dateTwitter release], dateTwitter = nil; dateTwitter = date; [self setNeedsDisplay]; }

    Read the article

  • iPhone xcode array losing state after load

    - by Frames84
    Right i've had a search around and can't find anything. @synthesize list; // this is an NSArry -(void) viewDidLoad { NSArray *arr = [self getJSONFeed]; self.List = [arr retain]; // if i copy the access code into here it works fine. } -(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; NSArray *vals = [list objectAtIndex:row] retain]; NSString *id = [vals valueForKey:@"id"]; // ERROR } right i've taken some of the code to try and provide it as simple as possible, ignore typo's and memory leaks this is sorted. Basically when I select a row I can't get data out of my 'list' array object. Please can anyone help me out?

    Read the article

  • How to retreive Bundle Version in a label from project test-Info.plist in iphone?

    - by aman-gupta
    Hi, Here I m pasting my codes where i want to retrive Bundle version from my test-Info.plist. // // testAppDelegate.h // test // // Created by Fortune1 on 20/04/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import <UIKit/UIKit.h> @class testViewController; @interface testAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; testViewController *viewController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet testViewController *viewController; @end ////////////// // // testAppDelegate.m // test // // Created by Fortune1 on 20/04/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import "testAppDelegate.h" #import "testViewController.h" @implementation testAppDelegate @synthesize window; @synthesize viewController; - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override point for customization after app launch [window addSubview:viewController.view]; [window makeKeyAndVisible]; } - (void)dealloc { [viewController release]; [window release]; [super dealloc]; } @end ///////////////////// // // testViewController.h // test // // Created by Fortune1 on 20/04/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import <UIKit/UIKit.h> @interface testViewController : UIViewController { UILabel *label; } @property(nonatomic,retain) IBOutlet UILabel *label; @end /////////////////////// // // testViewController.m // test // // Created by Fortune1 on 20/04/10. // Copyright __MyCompanyName__ 2010. All rights reserved. // #import "testViewController.h" @implementation testViewController @synthesize label; /* // The designated initializer. Override to perform setup that is required before the view is loaded. - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } */ /* // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { } */ - (void)viewDidLoad { [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@"test-info" ofType:@"plist"]; NSString *versionString = [NSString stringWithFormat:@"v%d", [plistData objectForKey:@"Bundle version"]]; label.text = versionString; } /* // Override to allow orientations other than the default portrait orientation. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } */ - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end But still I got null value where i m wrong please help me out Thanks in advance

    Read the article

  • Why doesen't the number 2 work in this for-loop?

    - by Emil
    Hello. I have a function that runs trough each element in an array. It's hard to explain, so I'll just paste in the code here: NSLog(@"%@", arraySub); for (NSString *string in arrayFav){ int favoriteLoop = [string intValue] + favCount; NSLog(@"%d", favoriteLoop); id arrayFavObject = [array objectAtIndex:favoriteLoop]; [arrayFavObject retain]; [array removeObjectAtIndex:favoriteLoop]; [array insertObject:arrayFavObject atIndex:0]; [arrayFavObject release]; id arraySubFavObject = [arraySub objectAtIndex:favoriteLoop]; [arraySubFavObject retain]; [arraySub removeObjectAtIndex:favoriteLoop]; [arraySub insertObject:arraySubFavObject atIndex:0]; [arraySubFavObject release]; id arrayLengthFavObject = [arrayLength objectAtIndex:favoriteLoop]; [arrayLengthFavObject retain]; [arrayLength removeObjectAtIndex:favoriteLoop]; [arrayLength insertObject:arrayLengthFavObject atIndex:0]; [arrayLengthFavObject release]; } NSLog(@"%@", arraySub); The array arrayFav contains these strings: "3", "8", "2", "10", "40". Array array contains 92 strings with a name. Array arraySub contains numbers 0 to 91, representing a filename with a title from the array array. Array arrayLength contains 92 strings representing the size of each file from array arraySub. Now, the first NSLog shows, as expected, the numbers 0 to 91. The NSLog-s in the loop shows the numbers 3, 8, 2, 10, 40, also as expected. But here's the odd part: the last NSLog shows these numbers: 40, 10, 0, 8, 3, 1, 2, 4, 5, 6, 7, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91 that is 40, 10, 0, 8, 3, and so on. It was not supposed to be a zero in there, it was supposed to be a 2.. Do you have any idea at why this is happening or a way to fix it? Thank you.

    Read the article

  • Methods in Customized View did not get invoke in AppDelegate, Why?

    - by NorthKyut
    I want the methods pauseGame in customized UIView - MyGameView get invoked when the phone is locked or interrupted. So I have a pauseGame method but it can't stop the timer when user lock screen (command+L). The lock screen did appear but the game still running at the background. So I added the testPause method to MyGameView and MyGameAppDelegate and and put a breakpoint to debug it. When screen locked it, the screen lock appeared and the code did stop at the breakpoint. But when I tried to step into the testPause method, it didn't take me to the method in MyGameView (it just passed it, not skipped) and no message was printed on terminal by NSLog. Why? What did I miss? // // MyGameAppDelegate.h // MyGame // #import <UIKit/UIKit.h> @class MyGameViewController; @class MyGameView; @interface MyGameAppDelegate : NSObject { UIWindow *window; MyGameViewController *viewController; MyGameView *view; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet MyGameViewController *viewController; @property (nonatomic, retain) IBOutlet MyGameView *view; @end // // MyGameAppDelegate.m // MyGame // #import "MyGameAppDelegate.h" #import "MyGameViewController.h" #import "MyGameView.h" @implementation MyGameAppDelegate @synthesize window; @synthesize viewController; @synthesize view; - (void)applicationWillResignActive:(UIApplication *)application { /* Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. */ [view pauseGame]; [view testPause]; } @end // // MyGameView.h // MyGame @interface MyGameView : UIView { - (void)pauseGame; - (void)testPause; @end // // MyGameView.m // MyGame // #import "MyGameView.h" #import "AtlasSprite.h" #import "MyGameViewController.h" #import "SecondViewController.h" @implementation MyGameView - (void)pauseGame { [theTimer invalidate]; theTimer = nil; } - (void)testPause{ NSLog(@"TestPause"); } @end

    Read the article

  • Cocos2d-x Spritebatch node animation appears to be broken? cocos2d-x 2.0.3

    - by George Host
    Hi I have spent aprox 2 days trying to get this to work doing a google searches left and right and I did get it working except for sprite batch nodes. So in my class I am able to load kuwalio_stand.png and I tested kuwalio_walk1.png and 2 and 3 from the FrameCache(). They work for sure 100%. I run this code and it does not animate does anyone else have the same issue with sprite batch nodes? cocos2d::CCSprite * player = Player::create(); player->setPosition(cocos2d::CCPointMake(0.0f,0.0f)); player->setDisplayFrame(cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_stand.png")); player->setTag(PlayerTag); cocos2d::CCAnimation * walk = cocos2d::CCAnimation::create(); cocos2d::CCSpriteFrame * walk1 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_walk1"); cocos2d::CCSpriteFrame * walk2 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_walk2"); cocos2d::CCSpriteFrame * walk3 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_walk3"); walk->addSpriteFrame(walk1); walk->addSpriteFrame(walk2); walk->addSpriteFrame(walk3); cocos2d::CCAnimate * actionWalk = cocos2d::CCAnimate::create(walk); cocos2d::CCRepeatForever * actionRepeat = cocos2d::CCRepeatForever::create(actionWalk); walk->setDelayPerUnit(0.1f); actionWalk->setDuration(10.1f); this->runAction(actionRepeat); // Change camera to a soft follow camera. this->runAction(cocos2d::CCFollow::create(player)); mSceneSpriteBatchNode->addChild(player); // Have the CCNode object run its virtual update function as fast as possible. // Every frame for this layer. this-scheduleUpdate(); Counter example without the sprite batch node... cocos2d::CCSprite * sprite = cocos2d::CCSprite::create("kuwalio_walk1.png"); this->addChild(sprite,0); sprite->setPosition(cocos2d::CCPointMake(60,60)); sprite->retain(); cocos2d::CCAnimation * actionAnimation = cocos2d::CCAnimation::create(); actionAnimation->setDelayPerUnit(0.01f); actionAnimation->retain(); actionAnimation->addSpriteFrameWithFileName("kuwalio_walk1.png"); actionAnimation->addSpriteFrameWithFileName("kuwalio_walk2.png"); actionAnimation->addSpriteFrameWithFileName("kuwalio_walk3.png"); cocos2d::CCAnimate * a = cocos2d::CCAnimate::create(actionAnimation); a->setDuration(0.10f); cocos2d::CCRepeatForever * actionRepeat = cocos2d::CCRepeatForever::create(a); sprite->runAction(actionRepeat);

    Read the article

  • Spritebatch node animation appears to be broken in cocos2d-x 2.0.3

    - by George Host
    Hi I have spent aprox 2 days trying to get this to work doing a google searches left and right and I did get it working except for sprite batch nodes. So in my class I am able to load kuwalio_stand.png and I tested kuwalio_walk1.png and 2 and 3 from the FrameCache(). They work for sure 100%. I run this code and it does not animate does anyone else have the same issue with sprite batch nodes? cocos2d::CCSprite * player = Player::create(); player->setPosition(cocos2d::CCPointMake(0.0f,0.0f)); player->setDisplayFrame(cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_stand.png")); player->setTag(PlayerTag); cocos2d::CCAnimation * walk = cocos2d::CCAnimation::create(); cocos2d::CCSpriteFrame * walk1 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_walk1.png"); cocos2d::CCSpriteFrame * walk2 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_walk2.png"); cocos2d::CCSpriteFrame * walk3 = cocos2d::CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("kuwalio_walk3.png"); walk->addSpriteFrame(walk1); walk->addSpriteFrame(walk2); walk->addSpriteFrame(walk3); cocos2d::CCAnimate * actionWalk = cocos2d::CCAnimate::create(walk); cocos2d::CCRepeatForever * actionRepeat = cocos2d::CCRepeatForever::create(actionWalk); walk->setDelayPerUnit(0.1f); actionWalk->setDuration(10.1f); player->runAction(actionRepeat); // Change camera to a soft follow camera. this->runAction(cocos2d::CCFollow::create(player)); mSceneSpriteBatchNode->addChild(player); // Have the CCNode object run its virtual update function as fast as possible. // Every frame for this layer. this-scheduleUpdate(); Counter example without the sprite batch node... cocos2d::CCSprite * sprite = cocos2d::CCSprite::create("kuwalio_walk1.png"); this->addChild(sprite,0); sprite->setPosition(cocos2d::CCPointMake(60,60)); sprite->retain(); cocos2d::CCAnimation * actionAnimation = cocos2d::CCAnimation::create(); actionAnimation->setDelayPerUnit(0.01f); actionAnimation->retain(); actionAnimation->addSpriteFrameWithFileName("kuwalio_walk1.png"); actionAnimation->addSpriteFrameWithFileName("kuwalio_walk2.png"); actionAnimation->addSpriteFrameWithFileName("kuwalio_walk3.png"); cocos2d::CCAnimate * a = cocos2d::CCAnimate::create(actionAnimation); a->setDuration(0.10f); cocos2d::CCRepeatForever * actionRepeat = cocos2d::CCRepeatForever::create(a); sprite->runAction(actionRepeat);

    Read the article

  • Perforce: Best diff editor on Linux ?

    - by shan23
    I'm looking for a Linux based diff viewer/editor for Perforce, which would allow me to retain my VIM editing shortcuts, at the same time having the navigational advantages of a diff editor (goto next/previous edit, view old and new side by side). I have a very good Windows diff viewer(BC3), so please don't suggest anything for Windows. If that editor doesn't require X server (i.e it can be used from cmd line in a putty session), that would be ideal !!

    Read the article

  • If incentive pay is considered harmful, what are the other options? [closed]

    - by Ricardo Cardona Ramirez
    Possible Duplicate: What kind of innovative non-cash financial benefits do I offer to my developers to retain them along with a competitive salary? I recently read about incentive payments and their consequences. In our company we have a bonus according to the developer's performance, but it has brought many problems, such as those described in the article. If the subsidies are damaging, what choice do we have?

    Read the article

  • When to use SOAP over REST

    So, how does REST based services differ from SOAP based services, and when should you use SOAP? Representational State Transfer (REST) implements the standard HTTP/HTTPS as an interface allowing clients to obtain access to resources based on requested URIs. An example of a URI may look like this http://mydomain.com/service/method?parameter=var1&parameter=var2. It is important to note that REST based services are stateless because http/https is natively stateless. One of the many benefits for implementing HTTP/HTTPS as an interface is can be found in caching. Caching can be done on a web service much like caching is done on requested web pages. Caching allows for reduced web server processing and increased response times because content is already processed and stored for immediate access. Typical actions performed by REST based services include generic CRUD (Create, Read, Update, and Delete) operations and operations that do not require state. Simple Object Access Protocol (SOAP) on the other hand uses a generic interface in order to transport messages. Unlike REST, SOAP can use HTTP/HTTPS, SMTP, JMS, or any other standard transport protocols. Furthermore, SOAP utilizes XML in the following ways: Define a message Defines how a message is to be processed Defines the encoding of a message Lays out procedure calls and responses As REST aligns more with a Resource View, SOAP aligns more with a Method View in that business logic is exposed as methods typically through SOAP web service because they can retain state. In addition, SOAP requests are not cached therefore every request will be processed by the server. As stated before Soap does retain state and this gives it a special advantage over REST for services that need to preform transactions where multiple calls to a service are need in order to complete a task. Additionally, SOAP is more ideal for enterprise level services that implement standard exchange formats in the form of contracts due to the fact that REST does not currently support this. A real world example of where SOAP is preferred over REST can be seen in the banking industry where money is transferred from one account to another. SOAP would allow a bank to perform a transaction on an account and if the transaction failed, SOAP would automatically retry the transaction ensuring that the request was completed. Unfortunately, with REST, failed service calls must be handled manually by the requesting application. References: Francia, S. (2010). SOAP vs. REST. Retrieved 11 20, 2011, from spf13: http://spf13.com/post/soap-vs-rest Rozlog, M. (2010). REST and SOAP: When Should I Use Each (or Both)? Retrieved 11 20, 2011, from Infoq.com: http://www.infoq.com/articles/rest-soap-when-to-use-each

    Read the article

  • Why would someone want to take over control of my domain name?

    - by mike jones
    I was approached by a person wanting to help me set up a website. In order to do this he has requested that I allow him to transfer my domain name to his account, for easier management. I would retain the right of usage and he would pay the bill for maintaining the name. This sounds fishy, but I can't figure out what he hopes to gain if this is a scam. Is this a common practice among 'Administrative Contacts'?

    Read the article

  • Working with the new FSP dispersion rules

    - by Kevin Smith
    In a previous post I provided instructions for how you can remove the dispersion directories that are present in the default storage rule in the PS3 release of UCM (11.1.1.4.0). In this post I will describe a suggested approach for working with the new dispersion rules so that new content takes advantage of the dispersion rules but migrated content uses the legacy file paths so it will retain its current web URLs.

    Read the article

  • Stuff you should have learned in school but didn't pay attention to at the time

    - by HLGEM
    This question made me think that there was a better question to ask. What did you learn in school that you didn't care about at the time, but turned out to be useful or you had to relearn in the workplace because you had it in school, but didn't retain the information and you needed it? (I mean for software related jobs.) I think this might help college students identify some of what they really should be paying attention to while they are in school.

    Read the article

  • Best Settings for Ubuntu Installation

    - by Umair Mustafa
    I need to install ubuntu 12.04 as i messed up my OS. So can someone please suggest what are the best settings for Partitions. I mean should I install the Ubuntu on simple one partition. Because in this case I guess I have to install all the packages/applications everytime I install the fresh OS which is a headache. Is there a way that I can retain all the applications on New installed OS ???? My HDD size is 120 GB

    Read the article

  • Create a Loyalty Program That Sticks - Thursday 30 Minute Webcast

    - by Charles Knapp
    Loyalty programs don't necessarily translate into loyal or profitable customers. What are market leaders doing to retain customers? Webcast Alert: Live complimentary webcast, Creating a Holistic Loyalty Program That Sticks, on Thursday, 11/15 at 1:00-1:30 pm EST. Southwest Airlines joins 1to1 Media to share insights on developing loyalty programs that are focused on customer needs and preferences. Hope to see you there! 

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >