Search Results

Search found 3457 results on 139 pages for 'cocoa'.

Page 10/139 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Cocoa NSString explode

    - by dododedodonl
    Hi all, I have a NSString: @"1a,1b,1c,1d,5c". I want this NSString separated into a NSMutableArray, but I don't know how. I think it is fairly simple but I can't find it (maybe because my English isn't good enough to find a good description for it to search on). Regards, Dodo

    Read the article

  • iPhone sdk Cocoa Touch - Pass touches down from parent UIView to child UIScrollview

    - by Joe
    I have a UIView inside my xib in IB and inside that is a UIScrollview that is a small 80x80 square and dynamically loaded with 8 or so 80 x 80 thumbnail images. The UIScrollview is not clipping the images so that they extend out either side so you can swipe left and right to scroll a chosen image into the the centre, paging is on so they snap ti each image. I have researched and found this is the best and possibly only way to do this. The UIScrollview sits in a 'container' UIView for one reason, it is there to receive the touches/swipes and pass them down to it's child the UIScrollview as otherwise all touches would have to start in the small 80x80 UIScrollview area and I wan them to be anywhere along the row of images. I have seen some sample code somewhere for doing this but just can not implement it. Treat me as a noob, starting from beginning to end, how should the UIView and UIScrollview be set up in IB to allow any touches to be passed, and what code should I put into where? The UIView is set up as scroll_container and the child UIScrollview is char_scroll At the moment I have got it all working except for the touches being passed from the parent to the child, and at the moment the touches have to always start inside the UIScrollview (tiny 80x80 box in centre) when I want to be able to swipe left or right in the long 480X80 horizontal parent UIView and have this still scroll the child UIScrollview. Hope you can help and understand what I mean!

    Read the article

  • Cocoa NSOutlineView bug - [NSCFTimer copyWithZone:]: unrecognized selector sent to instance

    - by Circle
    I'm using an NSOutlineView with the function - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item defined so it gives the group row GUI look. When I add a root item, it works fine. When I add an item to root's child array and expand it, it works fine. If I contract the item though, the following error is logged: [NSCFTimer copyWithZone:]: unrecognized selector sent to instance I also get an EXC_BAD_ACCESS error if the app window is deactivated by switching to another app. I used the debugger to try to find where I might have made an error in one of my functions, but the stack trace only shows functions I did not create (RunCurrentEventLoopInMode, CFRunLoopRunSpecific, handleWindowNeedsDisplay, etc.) Does anyone have any idea where my error(s) might be?

    Read the article

  • cocoa - making a class like UIButton

    - by Mike
    For some reason that will take too much time to explain, I have to create a UIImageView based class that has some properties of a button. Imagine a class like the UISwitch (no I cannot base my class on the UISwitch) with two states, on and off. WHen the user selects one state, it runs a method like a button that was clicked and the method receives the sender id. I have already the class more or less working. The class is based on UIImageView. I am having difficulties to understand the following. WHen I create a new button I have a line that is like [myButton addTarget:self action:NSSelectorFromString(myMethod) forControlEvents:UIControlEventTouchUpInside]; This line defines a target and an action to run when the button is triggered. I my case I would need something like [myObject addTarget:self action:myMethod ifState:1] //or another thing ifState:2 I have no idea what kind of code I should put on the class to make this work. Remember that as a button the class should send the "sender" information to identify the object which triggered the action... Can you guys, transcendental gurus help? thanks.

    Read the article

  • cocoa - converting a double to string

    - by Mike
    I have a double number and I would like to convert it to string. The number is, for example, something like 24.043333332154465777... but if I convert it to string using something like NSString *myString = [NSString stringWithFormat:@"%f", myDouble]; The string is just 24.043333 how do I get a full string the corresponds to the whole double number? What other methods do I have to convert this?

    Read the article

  • How to handle HTML Strings in Cocoa Touch

    - by balexandre
    I'm using a RSS Reader and works fine when I tap the UITableViewCell to load the <link> either in a UIWebView or to open Safari on that link. But I really want to learn how to load the Topic content into the application instead showing the entire site or jump to Safari In the RSS feed per each <item> there is a <body> tag (and a <Description> that contains the same but encoded) that contains the topic content, like the image below shows: So, instead of catching the <link> I'm assigning the <body>. Problem is that it does not work correctly :-( for this example I only get the content until the first <br> nothing more. I'm using a NSString as I would use in C#, should I use any other object, is there a better object to use on such data? Should I use an UITextView to load this information (as it has scroll already) or I should use a UIWebView instead? Thank you.

    Read the article

  • Paypal and Cocoa

    - by happyCoding25
    Hello, I want to have a donation box via paypal in a sheet. When the sheet comes down a webview within the sheet loads the donation box website. I want to close the sheet when the user has completed the donation. Any ideas? Thanks in advance

    Read the article

  • Slider value available between different cocoa classes

    - by Miguel Bayona
    I am playing around with an iPhone app, and need to accomplish something that I am sure is very basic: I have a slider that is implemented in a Controller.m class. However, I need its value must be available in a different class, MainView.m class where I have defined an equation that depends on the value of the slider. How can I do it?? Thanks, Miguel Bayona

    Read the article

  • Cocoa - array not sorting?

    - by Mike
    I have this set NSMutableSet *mySet = [NSMutableSet setWithObjects: @"2", @"8", @"7", @"0", @"3", nil]; I copy the set to an array and sort it using NSArray *sortedArray = [[mySet allObjects] sortedArrayUsingSelector:@selector(compare:)]; The resulting array is in exactly the same order as the set and is not being sorted. Why? thanks for any help. EDIT: CORRECING A TYPO.

    Read the article

  • Cocoa - simple collada parser

    - by madsonic
    I´ve been researching a bit in the net but didnt find any Straightforward answer, i am looking for a simple way to Load Vertex and U/V data from a collada .dae file, i don´t need textures and normals for my application (for now) but i want it as lightweight&fast as possible. Any hints or existing solutions?

    Read the article

  • JSON in COCOA (with YAJL)

    - by mekanics
    at first, sry for my english... :) I'm using the YAJL Framework http://github.com/gabriel/yajl-objc My file look like this: [ [ 3753700, { "altitude" : 36950, "heading" : 129.918421384319, "latitude" : 47.554033252495699, "longitude" : 8.2125612837369903, "pointType" : "EXTRAPOLATED", "speed" : 455.04395392093699, "timestamp" : 1273252673301, "verticalRate" : 0.0 } ], [ 3753700, { "altitude" : 36950, "heading" : 129.918421384319, "latitude" : 47.552708437680799, "longitude" : 8.2149074662342798, "pointType" : "EXTRAPOLATED", "speed" : 455.04395392093699, "timestamp" : 1273252674555, "verticalRate" : 0.0 } ] ] I've tried it in x-variant, but I always get a 'NSInvalidArgumentException' from console: 2010-05-07 20:17:30.998 testApp[2365:207] *** -[NSConcreteData yajl_JSON]: unrecognized selector sent to instance 0x1353d0 2010-05-07 20:17:31.006 testApp[2365:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSConcreteData yajl_JSON]: unrecognized selector sent to instance 0x1353d0' How to read the data correctly? thx for help

    Read the article

  • [Cocoa] NSTask string encoding problem

    - by ryyst
    Hi, In my program, I'm grep-ing via NSTask. For some reason, sometimes I would get no results (even though the code was apparently the same as the command run from the CLI which worked just fine), so I checked through my code and found, in Apple's documentation, that when adding arguments to an NSTask object, "the NSTask object converts both path and the strings in arguments to appropriate C-style strings (using fileSystemRepresentation) before passing them to the task via argv[]" (snip). The problem is that I might grep terms like "Río Gallegos". Sadly (as I checked with fileSystemRepresentation), that undergoes the conversion and turns out to be "RiÃÅo Gallegos". How can I solve this? -- Ry

    Read the article

  • Layering Cocoa WebView - Drawing on top?

    - by Josh
    http://stackoverflow.com/questions/1618498/webview-in-core-animation-layer The only other thread I can find is the above which doesn't necessarily fit my needs. Is there a reliable way to simply draw a view on top of a webview? I've tried to layer a regular NSView on top of WebView, and it draws right at first, but any movement in the webview (scrolling the page etc) appears to invalidate the view and produces visual artifacts. I've tried: [[[NSApp mainWindow] contentView] addSubview:view positioned:NSWindowAbove relativeTo:webView]; No luck there, same problems -- z-ordering doesn't seem to work unless I'm missing something. Is this just a limitation of webviews? I also tried implementing the view above as a window, which worked much better (just controlled the location of the window programmatically). However, the desired behavior is for the user to enter some text into this window, but for it not to steal "focus" -- ie the main window goes inactive (the x - + go gray) when the user clicks on the text field in the new window. Any way to avoid that? I've tried subclassing NSWindow and overriding canBecomeKey (return YES) and canBecomeMain (return NO) but the window still steals focus. Josh

    Read the article

  • Cocoa NSOutlineView and Drag-and-Drop

    - by bobthecoder
    I recently started another thread without an account, so I'm reposting the question here with an account so I can edit current links to the program so other users can follow this. I have also updated the code below. Here is my original question: I read the other post here on Outlineviews and DND, but I can't get my program to work. At the bottom of this post is a link to a zip of my project. Its very basic with only an outlineview and button. I want it to receive text files being dropped on it, but something is wrong with my code or connections. I tried following Apple's example code of their NSOutline Drag and Drop, but I'm missing something. 1 difference is my program is a document based program and their example isn't. I set the File's Owner to receive delegate actions, since that's where my code to handle drag and drop is, as well as a button action. Its probably a simple mistake, so could someone please look at it and tell me what I'm doing wrong? Here is a link to the file: http://dl.dropbox.com/u/7195844/OutlineDragDrop1.zip

    Read the article

  • Looking for advice on importing large dataset in sqlite and Cocoa/Objective-C

    - by jluckyiv
    I have a fairly large hierarchical dataset I'm importing. The total size of the database after import is about 270MB in sqlite. My current method works, but I know I'm hogging memory as I do it. For instance, if I run with Zombies, my system freezes up (although it will execute just fine if I don't use that Instrument). I was hoping for some algorithm advice. I have three hierarchical tables comprising about 400,000 records. The highest level has about 30 records, the next has about 20,000, the last has the balance. Right now, I'm using nested for loops to import. I know I'm creating an unreasonably large object graph, but I'm also looking to serialize to JSON or XML because I want to break up the records into downloadable chunks for the end user to import a la carte. I have the code written to do the serialization, but I'm wondering if I can serialize the object graph if I only have pieces in memory. Here's pseudocode showing the basic process for sqlite import. I left out the unnecessary detail. [database open]; [database beginTransaction]; NSArray *firstLevels = [[FirstLevel fetchFromURL:url retain]; for (FirstLevel *firstLevel in firstLevels) { [firstLevel save]; int id1 = [firstLevel primaryKey]; NSArray *secondLevels = [[SecondLevel fetchFromURL:url] retain]; for (SecondLevel *secondLevel in secondLevels) { [secondLevel saveWithForeignKey:id1]; int id2 = [secondLevel primaryKey]; NSArray *thirdLevels = [[ThirdLevel fetchFromURL:url] retain]; for (ThirdLevel *thirdLevel in thirdLevels) { [thirdLevel saveWithForeignKey:id2]; } [database commit]; [database beginTransaction]; [thirdLevels release]; } [secondLevels release]; } [database commit]; [database release]; [firstLevels release];

    Read the article

  • cocoa hello world screensaver

    - by RW
    I have been studying NSView and as such I thought I would give a shot at a screen saver. I have been able to display and image in an NSView but I can't seen to modify this example code to display a simple picture in ScreenSaverView. http://www.mactech.com/articles/mactech/Vol.20/20.06/ScreenSaversInCocoa/ BTW great tutorial that works with Snow Leopard. I would think to simply display an image I would need something that looked like this... What am I doing wrong? // // try_screensaverView.m // try screensaver // #import "try_screensaverView.h" @implementation try_screensaverView - (id)initWithFrame:(NSRect)frame isPreview:(BOOL)isPreview { self = [super initWithFrame:frame isPreview:isPreview]; if (self) { [self setAnimationTimeInterval:1]; //refresh once per sec } return self; } - (void)startAnimation { [super startAnimation]; NSString *path = [[NSBundle mainBundle] pathForResource:@"leaf" ofType:@"JPG" inDirectory:@""]; image = [[NSImage alloc] initWithContentsOfFile:path]; } - (void)stopAnimation { [super stopAnimation]; } - (void)drawRect:(NSRect)rect { [super drawRect:rect]; } - (void)animateOneFrame { ////////////////////////////////////////////////////////// //load image and display This does not scale the image NSRect bounds = [self bounds]; NSSize newSize; newSize.width = bounds.size.width; newSize.height = bounds.size.height; [image setSize:newSize]; NSRect imageRect; imageRect.origin = NSZeroPoint; imageRect.size = [image size]; NSRect drawingRect = imageRect; [image drawInRect:drawingRect fromRect:imageRect operation:NSCompositeSourceOver fraction:1]; } - (BOOL)hasConfigureSheet { return NO; } - (NSWindow*)configureSheet { return nil; } @end

    Read the article

  • Cocoa giving error: <Error>: doClip: empty path.

    - by outtru.mp
    Coco gives error: Thu Jun 10 19:13:56 myComputer.local myApp[####] <Error>: doClip: empty path. But I don't have this function anywhere in my code (can't find by searching in frameworks / project)... Seems a lot of people complain about this because it goes into the console logs, but couldn't find any reason given as to what causes it on a progmatic level. Any thoughts as to what the problem is?

    Read the article

  • cocoa - IF failing for double?

    - by Mike
    I have a set of NSTimeIntervals like this: NSArray *mySet = [NSArray arrayWithObjects: [NSNumber numberWithDouble: time1], // [NSNumber numberWithDouble: time2], [NSNumber numberWithDouble: time3], nil]; // suppose that at this time // time1 = 0.00000 // time2 = 18.3200 // time3 = 21.6500 at some point in my code I want to test if currentTime is greater or equal to one of the times on the array, so I do // currentTime = 18.32 right now for (int i=0; i<[mySet count]; i++) { if (currentTime >= [[mySet objectAtIndex:i] doubleValue]) { NSLog(@"%d...", i); } } The output should be "1...2..." but the output is just "1..." when i = 1, it is comparing 18.32 to 18.32 and failing to recognize that the value is equal or greater than the other? WTF??? How can that be? thanks for any help.

    Read the article

  • Looking for how-to use UIGraphicsSetPDFContextURLForRect on iOS or Cocoa

    - by user1676332
    I'm playing to manipulate PDF on iOS (display but also and mostly generation). I wish to embed rectangular areas which act as "external" links (URLs like http://host.tld/path/file). Do you know where I can find an example(s) of how to use the UIGraphicsSetPDFContextURLForRect function? I find absolutly nothing on Internet. If I understand well, the only requirement is that the current graphic context should be PDF "type" and I think I respect this since, upstream, I call UIGraphicsPushContext why my PDF context as parameter (this was anyway required for methods like drawAtPoint: that I use also with success). I do not think it is important but just in case I specify that this DOES NOT take place in the drawRect: of a View subclass. You're quite right to say me unequivocally that I have "all wrong". The graphical environment is so sophisticated and rich in iOS that I assume to have not assimilated more than 1 or 2% for now. Thank you in advance.

    Read the article

  • Accessing resources in the package of an application created with xcode/cocoa

    - by Michael Minerva
    I am trying to make a simple that needs to create an NSImage and I want to put the .png file in the resources of my package contents. I added the .png file to my resources directory in Xcode and when I create the applicaiton the .png file shows up in my resources inside package contents but I am havhing trouble figuring out how to reference file here is what I tried: [image initWithContentsOfFile:@"resources/draw-button.png"]; I figured that my package contents would be my current directory so I thought this would work, but it does. How do I reference my resources directory?

    Read the article

  • Cocoa-Created PDF Not Rendering Correctly

    - by Matthew Roberts
    I've created a PDF on the iPad, but the problem is when you have a line of text greater than 1 line, the content just goes off the page. This is my code: void CreatePDFFile (CGRect pageRect, const char *filename) { CGContextRef pdfContext; CFStringRef path; CFURLRef url; CFMutableDictionaryRef myDictionary = NULL; path = CFStringCreateWithCString (NULL, filename, kCFStringEncodingUTF8); url = CFURLCreateWithFileSystemPath (NULL, path, kCFURLPOSIXPathStyle, 0); CFRelease (path); myDictionary = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); NSString *foos = @"Title"; const char *text = [foos UTF8String]; CFDictionarySetValue(myDictionary, kCGPDFContextTitle, CFSTR(text)); CFDictionarySetValue(myDictionary, kCGPDFContextCreator, CFSTR("Author")); pdfContext = CGPDFContextCreateWithURL (url, &pageRect, myDictionary); CFRelease(myDictionary); CFRelease(url); CGContextBeginPage (pdfContext, &pageRect); CGContextSelectFont (pdfContext, "Helvetica", 12, kCGEncodingMacRoman); CGContextSetTextDrawingMode (pdfContext, kCGTextFill); CGContextSetRGBFillColor (pdfContext, 0, 0, 0, 1); NSString *body = @"text goes here"; const char *text = [body UTF8String]; CGContextShowTextAtPoint (pdfContext, 30, 750, text, strlen(text)); CGContextEndPage (pdfContext); CGContextRelease (pdfContext);} Now the issue lies within me writing the text to the page, but the problem is that I can't seem to specify a multi-line "text view".

    Read the article

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