Search Results

Search found 6745 results on 270 pages for 'objective c'.

Page 22/270 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Objective-C Framework PSMTabBarControl does not work

    - by ahmet2106
    Hello everybody In my App I'm trying to get PSMTabBarControl working, but all I do - nothing... I have copied the framework File in my Frameworks folder of my App, then included it. In my InterfaceBuilder (1.3.2) I was able to drag and drop the PSMTabBarControl to my Window and link it with the NSTabView (PSM - tabView - NSTabView && NSTabView - delegate - PSM), but after i tried a Demo (apple+r) I cant see the Tabs... Tried all I can - but dont know why.. Am I doing sth. wrong? Which other Framework or Source I can use to create Tabs like Firefox oder Safari? Thank you!

    Read the article

  • Strange inheritance behaviour in Objective-C

    - by Smikey
    Hi all, I've created a class called SelectableObject like so: #define kNumberKey @"Object" #define kNameKey @"Name" #define kThumbStringKey @"Thumb" #define kMainStringKey @"Main" #import <Foundation/Foundation.h> @interface SelectableObject : NSObject <NSCoding> { int number; NSString *name; NSString *thumbString; NSString *mainString; } @property (nonatomic, assign) int number; @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *thumbString; @property (nonatomic, retain) NSString *mainString; @end So far so good. And the implementation section conforms to the NSCoding protocol as expected. HOWEVER, when I add a new class which inherits from this class, i.e. #import <Foundation/Foundation.h> #import "SelectableObject.h" @interface Pet : SelectableObject <NSCoding> { } @end I suddenly get the following compiler error in the Selectable object class! SelectableObject.h:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'interface' This makes no sense to me. Why is the interface declaration for the SelectableObject class suddenly broken? I also import it in a couple of other classes I've written... Any help would be very much appreciated. Thanks! Michael

    Read the article

  • Minimize window effect of OS X on the iPhone - Objective-C

    - by ncohen
    Hi everyone, I would like to imitate the minimize window effect of OS X on the UIView's iPhone... I was thinking about making two animations: the first one extend and distort the view and the second one reduce the view! What do you think? My problem is to distort the view! Do you have any idea how I could make the whole thing? Thanks

    Read the article

  • Async call Objective C iphone

    - by Sam
    Hi guys, I'm trying to get data from a website- xml. Everything works fine. But the UIButton remains pressed until the xml data is returned and thus if theres a problem with the internet service, it cant be corrected and the app is virtually unusable. here are the calls: { AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; if(!appDelegate.XMLdataArray.count > 0){ [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; [appDelegate GetApps]; //function that retrieves data from Website and puts into the array - XMLdataArray. } XMLViewController *controller = [[XMLViewController alloc] initWithNibName:@"MedGearsApps" bundle:nil]; [self.navigationController pushViewController:controller animated:YES]; [controller release]; } It works fine, but how can I make the view buttons functional with getting stuck. In other words, I just want the UIButton and other UIButtons to be functional whiles the thing works in the background. I heard about performSelectorInMainThread but i cant put it to practice correctly any help is appreciated :)

    Read the article

  • Objective-C DOM XML parser for iPhone

    - by phunehehe
    Hello guys I'm looking for a way on the iPhone to parse an XML document using DOM. I have been using SAX with NSXMLParser but now I really want a DOM tree (or anything that can quickly translate the XML document into an NSDictionary) Thanks for any help

    Read the article

  • Objective C Enumerate Sentences in a paragraph

    - by Faz Ya
    I would like to write an enumerator that would go through a paragraph of text and gives me one sentence at a time. I tried using stringEnumerate with the NSStringEnumerationBySentences but that simply looks at the periods and fails. For example, lets say I have the following text Block: "Senator John A. Boehner decided not to move forward. He also decided not to call the congress. The news reporter said though...." I would like my function to break down the above paragraph in the following sentences: Senator John A. Boehner decided not to move forward He also decided not to call the congress (No third sentence because it's a half a sentence) The String Enumerator with the sentence optionjust looks at the periods and breaks down that way which is wrong: Senator John A. Boehner decided not to move forward He also decided not to call the congress The news reporter said though.... Is there any library or function that I can call that does a better job at this? Thanks - (NSMutableString *) getOnlyFullSentencesFromTextBlock:(NSMutableString *) textBlock{ [textBlock enumerateSubstringsInRange:NSMakeRange(0, [textBlock length]) options:NSStringEnumerationBySentences | NSStringEnumerationLocalized usingBlock:^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) { NSLog(@"Sentence Frag:%@", substring); }]; return textBlock; }

    Read the article

  • How to call a method through the object created by interface in Objective-C

    - by Cathy
    Hi, I need to call a method through the object created by the interface ie id<MyProtocol>obj; Now i have created this obj in my main class where i am not implementing the methods of this protocol but i need to access the method which is already implemented in someother class.I am now calling the method as follows [obj load]; in my main class in the applicationDidFinishLaunching, but i not able to access the method? Pls do suggest me the correct way of calling the methods through protocols...

    Read the article

  • iPhone/Objective-C struct question my own CGRectZero

    - by Mark
    I am designing a Padding struct as follows: /* Padding. */ struct CGPadding { CGFloat left; CGFloat top; CGFloat right; CGFloat bottom; }; typedef struct CGPadding CGPadding; CG_INLINE CGPadding CGPaddingMake(CGFloat left, CGFloat top, CGFloat right, CGFloat bottom) { CGPadding p; p.left = left; p.top = top; p.right = right; p.bottom = bottom; return p; } This all works perfectly well, the problem is how can I create a const CGPadding CGPaddingZero? If I do like this: const CGPadding CGPaddingZero = (CGPadding){0.0, 0.0, 0.0, 0.0}; It doesnt work. So what am I doing wrong?

    Read the article

  • Objective C Object Functioning & Passing Arrays

    - by Patrick
    I apologise if this has been asked before but I can't find the info I need. Basically I want a UITableView to be populated using info from a server, similar to the SeismicXML example. I have the parser as a separate object, is it correct to alloc, init an instance of that parser & then tell RootViewController to make it's table data source a copy of the parser's array. I can't include code because I haven't written anything yet, I'm just trying to get the design right before I start. Perhaps something like: xmlParser = [[XMLParser alloc] init]; [xmlParser getXMLData]; // Assuming xmlParser stores results in an array called returnedArray self.tableDataSource = xmlParser.returnedArray Is this the best way of doing it?

    Read the article

  • Objective-C Custom extend

    - by ryanjm.mp
    I have a couple classes that have nearly identical code. Only a string or two is different between them. What I would like to do is to make them from another class that defines those functions and then uses constants or something else to define those strings that are different. I'm not sure if "___" is inheritance or extending or what. That is what I need help with. For example: objectA.m: -(void)helloWorld { NSLog("Hello %@",child.name); } objectBob.m: #define name @"Bob" objectJoe.m #define name @"Joe" (I'm not sure if it's legal to define strings, but this gets the point across) It would be ideal if objectBob.m and objectJoe.m didn't have to even define the methods, just their relationship to objectA.m. Is there any way to do something like this? If all else fails I'll just make objectA.m: -(void)helloWorld:(NSString *name) { NSLog("Hello %@",name); } And have the other files call that function (and just #import objectA.m).

    Read the article

  • objective c NSURL may not respond to +initFileURLWithPath

    - by caballo7
    I have two lines of code in the applicationDidFinishLaunching function: NSString *targetFilePath = @"/Users/bob/Documents/About_Stacks.pdf"; NSURL *targetFileURL = [NSURL initFileURLWithPath:targetFilePath]; and I am getting the warning (title) in the second line... I have no idea what I am doing wrong. This is an absurdly simply application... I have read other posts about reordering methods, but I am using classes provided by NS, nothing of my own. Any advice would be much appreciated. Thanks.

    Read the article

  • Objective-C protocol vs inheritance vs extending?

    - by ryanjm.mp
    I have a couple classes that have nearly identical code. Only a string or two is different between them. What I would like to do is to make them "x" from another class that defines those functions and then uses constants or something else to define those strings that are different. I'm not sure if "x" is inheritance or extending or what. That is what I need help with. For example: objectA.m: -(void)helloWorld { NSLog("Hello %@",child.name); } objectBob.m: #define name @"Bob" objectJoe.m #define name @"Joe" (I'm not sure if it's legal to define strings, but this gets the point across) It would be ideal if objectBob.m and objectJoe.m didn't have to even define the methods, just their relationship to objectA.m. Is there any way to do something like this? It is kind of like protocol, except in reverse, I want the "protocol" to actually define the functions. If all else fails I'll just make objectA.m: -(void)helloWorld:(NSString *name) { NSLog("Hello %@",name); } And have the other files call that function (and just #import objectA.m).

    Read the article

  • Drawbacks with using Class Methods in Objective C.

    - by RickiG
    Hi I was wondering if there are any memory/performance drawbacks, or just drawbacks in general, with using Class Methods like: + (void)myClassMethod:(NSString *)param { // much to be done... } or + (NSArray*)myClassMethod:(NSString *)param { // much to be done... return [NSArray autorelease]; } It is convenient placing a lot of functionality in Class Methods, especially in an environment where I have to deal with memory management(iPhone), but there is usually a catch when something is convenient? An example could be a thought up Web Service that consisted of a lot of classes with very simple functionality. i.e. TomorrowsXMLResults; TodaysXMLResults; YesterdaysXMLResults; MondaysXMLResults; TuesdaysXMLResults; . . . n I collect a ton of these in my Web Service Class and just instantiate the web service class and let methods on this class call Class Methods on the 'Results' Classes. The classes are simple but they handle large amount of Xml, instantiate lots of objects etc. I guess I am asking if Class Methods lives or are treated different on the stack and in memory than messages to instantiated objects? Or are they just instantiated and pulled down again behind the scenes and thus, just a way of saving a few lines of code?

    Read the article

  • enabling the "return button" in a UITextField keyboard (objective-c/iphone)

    - by peter61
    When I start editing a UITextField, I have the "Clear When Editing Begins" option checked so it starts off with no text. However, the "Return" button is grayed out until you type at least one character. I've seen other iphone apps where the "Return" button is not grayed out (and if you press it with no text, then it goes back to what the text used to be). How is this done? Thanks.

    Read the article

  • Instance caching in Objective C

    - by zoul
    Hello! I want to cache the instances of a certain class. The class keeps a dictionary of all its instances and when somebody requests a new instance, the class tries to satisfy the request from the cache first. There is a small problem with memory management though: The dictionary cache retains the inserted objects, so that they never get deallocated. I do want them to get deallocated, so that I had to overload the release method and when the retain count drops to one, I can remove the instance from cache and let it get deallocated. This works, but I am not comfortable mucking around the release method and find the solution overly complicated. I thought I could use some hashing class that does not retain the objects it stores. Is there such? The idea is that when the last user of a certain instance releases it, the instance would automatically disappear from the cache. NSHashTable seems to be what I am looking for, but the documentation talks about “supporting weak relationships in a garbage-collected environment.” Does it also work without garbage collection? Clarification: I cannot afford to keep the instances in memory unless somebody really needs them, that is why I want to purge the instance from the cache when the last “real” user releases it. Better solution: This was on the iPhone, I wanted to cache some textures and on the other hand I wanted to free them from memory as soon as the last real holder released them. The easier way to code this is through another class (let’s call it TextureManager). This class manages the texture instances and caches them, so that subsequent calls for texture with the same name are served from the cache. There is no need to purge the cache immediately as the last user releases the texture. We can simply keep the texture cached in memory and when the device gets short on memory, we receive the low memory warning and can purge the cache. This is a better solution, because the caching stuff does not pollute the Texture class, we do not have to mess with release and there is even a higher chance for cache hits. The TextureManager can be abstracted into a ResourceManager, so that it can cache other data, not only textures.

    Read the article

  • Objective-C++ Memory Problem

    - by Stephen Furlani
    Hello, I'm having memory woes. I've got a C++ Library (Equalizer from Eyescale) and they use the Traversal Visitor Pattern to allow you to add new functionality to their classes. I've finally figured out how it works, and I've got a Visitor that just returns the properties from one of the objects. (since I don't know how they're allocated). so. My little code does this: VisitorResult AGLContextVisitor::visit( Channel* channel ) { // Search through Nodes, Pipes until we get to the right window. // Add some code to make sure we find the right one? // Not executing the following code as C++ in gdb? eq::Window* w = channel->getWindow(); OSWindow* osw = w->getOSWindow(); AGLWindow* aw = (AGLWindow *)osw; AGLContext agl_ctx = aw->getAGLContext(); this->setContext(agl_ctx); return TRAVERSE_PRUNE; } So here's the problem. eq::Window* w = channel->getWindow(); (gdb) print w 0x0 BUT If I do this: (gdb) set objc-non-blocking-mode off (gdb) print w=channel->getWindow() 0x300effb9 // an honest memory location, and sets w as verified in the Debugger window of XCode. It does the same thing for osw. I don't get it. Why would something work in (gdb) but not in the code? The file is completely a cpp file, but it seems to be running in objc++, since I need to turn blocking off. Help!? I feel like I'm missing some memory-management basic thing here, either with C++ or Obj-C. [edit] channel-getWindow() is supposed to do this: /** @return the parent window. @version 1.0 */ Window* getWindow() { return _window; } The code also executes fine if I run it from a C++-only application. [edit] No... I tried creating a simple stand-alone program since I was tired of running it as a plugin. Messy to debug. And no, it doesn't run in the C++ program either. So I'm really at a loss as to what I'm doing wrong. Thanks, -- Stephen Furlani

    Read the article

  • How to use the asin() function in objective c

    - by Daniel Thatcher
    I am trying to use the asin() function in an iOS app to calculate an angle from the y axis. I am using trigonometry, but I must be doing something wrong with the asin() function, as when I try to pass in 0.707.... as asin(rotation) where rotation is a double equivalent to 0.707..., I get around 0.78....., where as my calculator gives me 44.991..., which is about correct from the variables passed in. What am I doing wrong, please can somebody help me?

    Read the article

  • Objective-C subclass and base class casting

    - by ryanjm.mp
    I'm going to create a base class that implements very similar functions for all of the subclasses. This was answered in a different question. But what I need to know now is if/how I can cast various functions (in the base class) to return the subclass object. This is both for a given function but also a function call in it. (I'm working with CoreData by the way) As a function within the base class (this is from a class that is going to become my subclass) +(Structure *)fetchStructureByID:(NSNumber *)structureID inContext:(NSManagedObjectContext *)managedObjectContext {...} And as a function call within a given function: Structure *newStructure = [Structure fetchStructureByID:[currentDictionary objectForKey:@"myId"]]; inContext:managedObjectContext]; Structure is one of my subclasses, so I need to rewrite both of these so that they are "generic" and can be applied to other subclasses (whoever is calling the function). How do I do that? Update: I just realized that in the second part there are actually two issues. You can't change [Structure fetch...] to [self fetch...] because it is a class method, not an instance method. How do I get around that too?

    Read the article

  • How to upload video to favorite/playlist using gdata in objective c

    - by Swati
    hi, i am trying to upload a video to favorite in my account but it shows Invalid request Uri and status code =400 i dont understand how should i format my request my code NSURL *url = [NSURL URLWithString: http://gdata.youtube.com/feeds/api/users/username/favorite]; ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; [request setPostValue:@"gdata.youtube.com" forKey:@"Host"]; [request setPostValue:@"application/atom+xml" forKey:@"Content-Type"]; [request setPostValue:@"CONTENT_LENGTH" forKey:@"Content-Length"]; [request setPostValue:@"" forKey:@"AuthSubToken"]; [request setPostValue:@"2" forKey:@"GData-Version"]; [request setPostValue:developer_key forKey:@"X-GData-Key"]; [request setPostValue:xml_data forKey:@"API_XML_Request"]; [request setDelegate:self]; [request setDidFailSelector:@selector(requestFailed:)]; [request setDidFinishSelector:@selector(gotTheResponse:)]; [[networkQueue go]; i have auth token and developer key, VIDEO_ID.but m not sure how to pass xml data in post request: <?xml version="1.0" encoding="UTF-8"?> <entry xmlns="http://www.w3.org/2005/Atom"> <id>VIDEO_ID</id> </entry> NSString *xml_data = contains xml data in string form

    Read the article

  • How to execute statements in order in objective c

    - by Vu Tu?n Anh
    When i tap on my button, my function was called [myBtn addTarget:self action:@selector(myFunction) forControlEvents:UIControlEventTouchUpInside]; In my function, a collection of complex statement will be executed and take a litte bit time to run, so i want to show Loading (UIActivityIndicatorView) as the following: -(void) addTradeAction { //Show Loading [SharedAppDelegate showLoading]; //disable user interaction self.view.userInteractionEnabled = NO; //execute call webservice in here - may be take 10s //Hide Loading [ShareAppDelegate hideLoading]; } When tap on myBtn (my Button) - after 3s or 4s, [ShareAppDelegate showLoading] was called. It is unusual when i use [ShareAppDelegate showLoading] on other Function, - it work very nice, i mean all the statement be executed in order. All i want, when i tap on My Button, Loading will be called immediatelly. Tks in advance

    Read the article

  • Objective-C global array of ints not working as expected

    - by Fran
    In my MyConstants.h file... I have: int abc[3]; In my matching MyConstants.m file... I have: extern int abc[3] = {11, 22, 33}; In each of my other *.m files... I have #import "MyConstants.h" Inside 1 of my viewDidLoad{} methods, I have: extern int abc[]; NSLog(@"abc = (%d) (%d)", abc[1], sizeof(abc)/sizeof(int)); Why does it display "abc = (0) (3)" instead of "abc = (22) (3)"? How do I make this work as expected?

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >