iOS From 1,99 To 1.99
Greetings! This is simple I'm sure and I'm just missing the proper class to do it. I need to convert a string representation from Canadian local to US Local. 1,99 to 1.99 The model is a float called quantity. From that model I pick up the value and display a localized representation of that float value into a UITextField (1,99) to allow user to edit the value, when the user is done updating the value I need to pick up the string from the text field and update the model. self.model.quantity = [self.numberTextView.text floatValue]; Only return 1.00 which is not correct. NSLocale *locale = [[NSLocale alloc]initWithLocaleIdentifier:@en_US]; NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init]; [formatter setLocale:locale]; [formatter setNumberStyle:NSNumberFormatterDecimalStyle]; NSNumber *number = [formatter numberFromString:self.numberTextView.text]; NSString *numberString = [[NSString stringWithFormat:@%.2f, [number floatValue] ]; NSLog(@%@,numberString); Returns 0.00, even worst!! What am I missing ? Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iOS From 1,99 To 1.99
Jens, thanks for replying. a, It's a convert From local, not Convert To local !!! I won't soon forget this one :) Sandro. On 2011-12-29, at 6:22 PM, Jens Alfke wrote: On Dec 29, 2011, at 1:39 PM, Sandro Noël wrote: NSLocale *locale = [[NSLocale alloc]initWithLocaleIdentifier:@en_US]; You're trying to parse a Canadian-format string, but initializing the formatter with the US locale. You probably want something like fr_CA (since I'm assuming this is a Quebecois thing only.) —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iOS Core Data complex predicate.
Andreas First off, thank you for taking the time to read my essay. I did not know the setReturnDistinctResults: was dependant on setPropertiesToFetch: your explanation is outstanding. That did the trick, and I thank you very much. Sandro. On 2011-03-17, at 6:49 PM, Andreas Grosam wrote: On Mar 17, 2011, at 8:15 PM, Sandro Noël wrote: Greetings! I am facing a problem with a complicated predicate I'm building. ... then this predicate is fed to a fetch Request which in turn is fed to a fetched Result Controller. the fetch is configured to [fetchRequest setReturnsDistinctResults:YES]; The problem as stated in the introduction this complete predicate returns multiple instances of the same record and it should not. About setReturnsDistinctResults: If YES, the request returns only distinct values for the *fields specified by propertiesToFetch*. That is, setReturnDistinctResults: makes only sense IFF you also specified the set of properties you want to fetch (via -setPropertiesToFetch). And this requires that you specify NSDictionaryResultType for the resultType property of the fetch request. As a result, with setReturnDistinctResults:YES you get a set of dictionaries whose values are distinct. In other words, you cannot use -setReturnsDistinctResults:YES to make your result set distinct if this array contains *managed objects*. You might use a NSSet which you initialize from your original array of managed objects in order to get a unique set. Alternatively, you might fetch just objectID properties using a NSDictionaryResultType. This, however, is a bit elaborated: When you return (unique) dictionaries as objects in your result array, and if you want these dictionaries having a key objectID which value corresponds the actual managed object of this dictionary instance, you need to create an appropriate NSExpressionDescription: and include this property description in the array which you pass to -setPropertiesToFetch: NSExpressionDescription* objectIdDescription = [[NSExpressionDescription alloc] init]; [objectIdDescription setExpression:[NSExpression expressionForEvaluatedObject]]; [objectIdDescription setExpressionResultType:NSObjectIDAttributeType]; Note: NSExpressionDescription is subclassed from NSPropertyDescription. Then you use objectIdDescription as one of the properties (NSPropertyDescription) you want to fetch: [myFetchRequest setPropertiesToFetch:[NSArray arrayWithObject: objectIdDescription]]; Don't forget to set the result type (after you set the entity): [myFetchRequest setResultType: NSDictionaryResultType]; [myFetchRequest setReturnsDistinctResults:YES]; ... The next step would be to extract the objectIDs from the array of dictionaries and store them in an array for convenience. Regards Andreas if any of you see a flaw in the logic or anything, please comment, I'm currently so deep into it, I cant see it anymore. :) I hope I have not missed nay details. Thank you!!! Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/apple.lists%40gestosoft.com This email sent to apple.li...@gestosoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iOS Core Data complex predicate.
Greetings! I am facing a problem with a complicated predicate I'm building. it keeps returning multiple instances of the same records. if every predicate used alone works as a charm, problems occur when they are combined together. my model is constructed as so Table 1 contains most descriptive fields. name description additional information. Table 2 contains the categories name for the category keyword Table 3 contains elements name of the element keyword table 1 has a to-many relationship to table 2 table 2 has a to many inverse relationship to table 1 table 1 has a to-many relationship to table 3 table 3 has a to many inverse relationship to table 1 -one item from table 1 can belong to many categories and one category can be assigned to multiple items from table 1 -one item from table 1 can have many elements, and one element can belong to many items of table 1; My search criteria's are as so. user can enter keywords to search the tiems. user can select from a list of categories the categories to search for. user can select fro ma list of elements the elements to include in the search. The keywords are separated in components and filtered against a StopWord array as to keep only the relevant words to build the predicate. each keyword is OR'd against three search field. and then AND together as to assure all keywords appear in one particular item of table 1 if ([self.searchText.text length] 0){ NSArray * components = [self.searchText.text componentsSeparatedByString:@ ]; for (NSString *component in components){ if (!isInFrenchStopWords(component)){ NSMutableArray *orSubPredicates = [NSMutableArray new]; [orSubPredicates addObject:[NSPredicate predicateWithFormat:@%@ IN[cd] self.name,component]]; [orSubPredicates addObject:[NSPredicate predicateWithFormat:@%@ IN[cd] self.description,component]]; [orSubPredicates addObject:[NSPredicate predicateWithFormat:@%@ IN[cd] self.addInfo,component]]; // build a OR Predicate for this particular keyword. [keywordsSubPredicates addObject:[NSCompoundPredicate orPredicateWithSubpredicates:orSubPredicates]]; [orSubPredicates release]; } } // keywords are combined in a AND predicate, all keywords must have a hit. [finalSubPredicates addObject:[NSCompoundPredicate andPredicateWithSubpredicates:keywordsSubPredicates]]; } Then if there are selected categories these are also predicated as so. the selected categories ManagedObject are stored in an NSDictionary A predicate is built for every selected category, because it is a many to many relationship. i've tried using category.name but that did not work. if ([self.categoryPredicateDict count]){ NSArray * components = [self.categoryPredicateDict allValues]; for (ModelCategory *component in components){ [categoriesSubPredicates addObject:[NSPredicate predicateWithFormat:@%@ IN[cd] categories,component]]; } // or any selected Category [finalSubPredicates addObject:[NSCompoundPredicate orPredicateWithSubpredicates:categoriesSubPredicates]]; } A predicate is built for every selected element, because it is a many to many relationship. if ([self.elementPredicateDict count]){ NSArray * components = [self.elementPredicateDict allValues]; for (ModelElement *component in components){ [elementSubPredicates addObject:[NSPredicate predicateWithFormat:@%@ IN[cd] elements,component]]; } // or any selected elements [finalSubPredicates addObject:[NSCompoundPredicate orPredicateWithSubpredicates:elementsSubPredicates]]; } and then to finalize everything and put it all together. return [NSCompoundPredicate andPredicateWithSubpredicates:finalSubPredicates]; then this predicate is fed to a fetch Request which in turn is fed to a fetched Result Controller. the fetch is configured to [fetchRequest setReturnsDistinctResults:YES]; The problem as stated in the introduction this complete predicate returns multiple instances of the same record and it should not. if any of you see a flaw in the logic or anything, please comment, I'm currently so deep into it, I cant see it anymore. :) I hope I have not missed nay
[iPhone] HTTPS / client Certificate / configuration profile
Greetings. Scenario: Our application accesses the content of a secure web server, the server is configured to ask the client for a certificate. and other security features. HTTPS 1: SSL connection to server with server certificate 2: SSL Client certificate (different cert issued for every user) 3: Basic Auth authentication over SSL. I've looked at the docs and took some code from Apple's advance NSURLConnection ...the server certificate challenge works fine. When I get to the client certificate challenge the code does not seem to be able to find the client certificate. I've tried installing the certificate 1: as part of a configuration profile...(iPhone config utility) 2: certificate sent in an email to the phone and installed directly on the phone The code from the advance NSURLConnection looks for certificates in the keychain, but does not seem to find anything to process and send back to the server. So my question is, how do I access a certificate that has been installed on the phone that does not seem to be in the keychain? Thank you for any pointers. best regards. Sandro, ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] HTTPS / client Certificate / configuration profile
When you tell Install certificate, I guess you mean Certificate and private key isn't it ? Yes the p12. Does it works if you try to log using Safari ? I'm using it to access https with cert based auth, and don't get any problem. Will try that and get back with the report. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] HTTPS / client Certificate / configuration profile
Yes it works. Thanks for the hint. Safari first asks me to accept the server certificate. second step it warns me that the web site demands a client certificate and asks me to choose one from a list. once selected i am prompted for user name and password from the server. Which is the intended process. I get the proper challenge from NSURLConnection delegate selectors. somehow my application does not find the certificates when it is being challenged for the client certificate. I must be doing something wrong in the lookup. to be honest all this authentication is still a little blurry for me at this point. I understand the concept...where should i look up for the certificates/credentials... it is somewhere else than the keychain ? to query the keychain I currently use... [NSDictionary dictionaryWithObjectsAndKeys: (id) kSecClassIdentity, kSecClass, kSecMatchLimitAll, kSecMatchLimit, kCFBooleanTrue, kSecReturnRef, nil], [NSDictionary dictionaryWithObjectsAndKeys: (id) kSecClassCertificate, kSecClass, kSecMatchLimitAll, kSecMatchLimit, kCFBooleanTrue, kSecReturnRef, nil], both query come back empty. Added info: The Configuration profile's Identity is the same as the Bundle identifier and the Entitlements application-identifier and the keychain-access-groups as i read, the applications only access keychains for their access groups. if that makes a difference... Sandro. On 2010-11-03, at 11:51 AM, Sandro Noël wrote: When you tell Install certificate, I guess you mean Certificate and private key isn't it ? Yes the p12. Does it works if you try to log using Safari ? I'm using it to access https with cert based auth, and don't get any problem. Will try that and get back with the report. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/apple.lists%40gestosoft.com This email sent to apple.li...@gestosoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] HTTPS / client Certificate / configuration profile
As i replied earlier, it works just fin in Safari for the iphone . as i mentioned, the problem lies in getting the certificate out of the configuration profile, from the within application. Historically, client certificates haven't really worked properly in Secure Transport, and therefore also not from Safari or from NSURLConnection. I don't know if this has been fixed or not; it's been a while since I tried using client certificates for authentication with OS X. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] UIButton and Device Orientation problem in MainWindow.
Greetings. I am trying to draw a UIButton in the application's main window so the button remains visible no matter what the user does in the sub view's. (TabBar based with a bunch of NavBars.)... This works great in the default device orientation. But left, right and upside down, the orientation of the button remains as if it was upright. I've tried adjusting the coordinates but the image drawn inside the button does not change orientation. when the phone is upside down, the image is upside down but the rest of the interface is well positioned. I'm sure the trick is simple but I can't seem to find it in google, or i'm not using the right therms. can someone point me in the right direction ? please :) Thank you all!! Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] UIButton and Device Orientation problem in MainWindow.
Matt that worked out perfectly! instead of [self.window addSubview:pButton]; changed it to [self.tabBarController.view addSubview:pButton]; Coordinates and orientation are now right in the spot ... thank you !!! Sandro. On 2010-10-28, at 3:54 PM, Matt Neuburg wrote: On Thu, 28 Oct 2010 14:10:28 -0400, Sandro No?l apple.li...@gestosoft.com said: Greetings. I am trying to draw a UIButton in the application's main window so the button remains visible no matter what the user does in the sub view's. (TabBar based with a bunch of NavBars.)... This works great in the default device orientation. But left, right and upside down, the orientation of the button remains as if it was upright. I've tried adjusting the coordinates but the image drawn inside the button does not change orientation. when the phone is upside down, the image is upside down but the rest of the interface is well positioned. I'm sure the trick is simple but I can't seem to find it in google, or i'm not using the right therms. can someone point me in the right direction ? please :) It's not a trick. You simply mustn't put the button in the window; it must go into the root view, the sole subview of the window, which is placed there and managed by a UIViewController. Start your app with the UIView-based App template and work from there, building your interface in the secondary nib. Read up on view controllers in the docs, which are excellent on this point. You may have to unwind the whole way your interface is constructed in order to do this, so start with just the button and add stuff back after you get that working. m. -- matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/ A fool + a tool + an autorelease pool = cool! AppleScript: the Definitive Guide - Second Edition! http://www.apeth.net/matt/default.html#applescriptthings ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Tracing an iPhone application/framework
On Oct 18, 2010, at 11:38 PM, Sandro Noël wrote: The framework is built as a template application from which classe/functions can be overloaded to fit the needs of the being built application. not much of an architecture if you ask me but i have to document it none the less. Isn't that what a framework is? A bunch of classes whose methods are intended to be overridden? You are absolutely right. a Framework should be a bunch of building blocks that you can put together and customize. NOT a whole application fitted into a static library, intended to be used as a temaplate. IMHO. I did use the class Model it was useful. but my intent in tracing the execution of the application is to figure out the chain of events... what happens... to comprehend the app/framework. Thanks for your reply. Best Regards. Sandro ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Iphone view from object not from controller.
Greetings. I am wondering if there is a way to ask the currently topmost windows controller to show a view... from a descendant of NSObject that has no clue of the view stack, if so, how do I get a reference to that view controller from that NSObject Descendant? Thanks! Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Tracing an iPhone application/framework
Greetings. The lead developer at my workplace left his brainchild behind but forgot to write any documentation for it. the framework is now quite unusable because it is quite extensive an no one knows the depth of it's architecture. I am mandated to document this framework. (Joy!) The framework is built as a template application from which classe/functions can be overloaded to fit the needs of the being built application. not much of an architecture if you ask me but i have to document it none the less. Is there any application out there or method in Xcode where I could trace every function call and figure out what object is being called and what function, thru out the first run of an application using that framework? Best regards. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Translation.
Greetings. I'm using Xcode 3.2.3 i'm a little confused as to why my translation files wont import back to the language of choice using ibtool. i exported the strings as so: ibtool --generate-strings-file MainWindow.strings English.lpoj/MainWindow.xib that worked fine and i sent the file to get translated, but when i try to reimport them it fails. either... ibtool --strings-file MainWindow.strings -–write French.lproj/MainWindow.xib English.lproj/MainWindow.xib or... ibtool --strings-file MainWindow.strings English.lproj/MainWindow.xib -–write French.lproj/MainWindow.xib or... ibtool --import-strings-file MainWindow.strings English.lproj/MainWindow.xib -–write French.lproj/MainWindow.xib returns keycom.apple.ibtool.errors/key array dict keydescription/key stringIllegal invocation. Try 'man ibtool' for more information./string /dict dict keydescription/key stringNot enough arguments provided; where is the input document to operate on?/string /dict /array /dict /plist I've looked on the net and this is how everyone is doing it, well at least where i can find anything. while issuing the command I am in the directory where the strings files are, and the english and french directories are located in there too. thanks for any pointers. Best regards. Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] NSPredicate formatting questions
Greetings. i'm trying to set a predicate to query some deep object in my model. my model is as so. member is part of a category the category has a name. while in a member resultset i want to filter the content on category names. [NSPredicate predicateWithFormat:@(caregory.name IN %@),[selections objectForKey:kPredicateFieldNamesArray]]; I crash with: 'unimplemented SQL generation for predicate : (caregory.name IN {Boutiques})' I've otherwise tried: [NSPredicate predicateWithFormat:@(carego...@name IN %@),[selections objectForKey:kPredicateFieldNamesArray]]; 'Unsupported KVC aggregate in keypath: carego...@name' Am I missing something? I thought KVC was part of the Predicates. any pointers are welcome. Sandro___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] NSPredicate formatting questions
Oh my god, I feel ashamed... that's what I get for working late. I'm sorry. On 2010-08-21, at 11:38 PM, Wyatt Webb wrote: On Aug 21, 2010, at 3:40 PM, Sandro Noël wrote: while in a member resultset i want to filter the content on category names. [NSPredicate predicateWithFormat:@(caregory.name IN %@),[selections objectForKey:kPredicateFieldNamesArray]]; I crash with: 'unimplemented SQL generation for predicate : (caregory.name IN {Boutiques})' I've otherwise tried: [NSPredicate predicateWithFormat:@(carego...@name IN %@),[selections objectForKey:kPredicateFieldNamesArray]]; 'Unsupported KVC aggregate in keypath: carego...@name' Am I missing something? I thought KVC was part of the Predicates. Not to state the obvious, but you did notice that your code has misspelled category, right? Is the property name correct? Wyatt___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/apple.lists%40gestosoft.com This email sent to apple.li...@gestosoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS
Greetings I'm having problems unarchiving my data in the iphone. here is the workout. 1: I archive a AttributedString to my CoreData NSData property using NSKeyedarchiver 2: Transfer the database to the iphone. 3: load the data using NSKeyedUnarchiver on the iphone. NSAttributedString *as = (NSAttributedString*)[NSKeyedUnarchiver unarchiveObjectWithData:attributedStringData]; that crashes saying: -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSFont) I understand that the NSFont is UIFont on the iphone, or has similarities. so i implemented a Delegate method to replace the class. //-- - (Class)unarchiver:(NSKeyedUnarchiver *)unarchiver cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray *)classNames{ if ([name isEqualToString:@NSFont]) return [UIFont class]; return nil; } but that never gets called because the class method does not allow for a delegate and instantiating the unarchiver class confuses me in how I should trigger the decoding once it is instantiated. Any pointers ? Sandro Noel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS
Glenn Ricky thank you for the insight. The reason I am trying to pass the attributed string from one platform to the other is exactly because I am using CoreText to render the string. is there a way to render plain RTF strings with core Text? best regards. On 2010-08-11, at 5:32 PM, glenn andreas wrote: You might be able to get away with using CoreText and it's attributes (which are based on CG/CT objects like CGColor and CTFont), but obviously that's not what you're going to get from AppKits default attributed string support. So you'll probably have to give up on using AppKit's NSAttributedString extensions all together, and switch to the CoreText ones (and take advantage of the CFAttributedString/NSAttributedString toll free bridging). Glenn Andreas gandr...@gandreas.com The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSKeyedArchiver on OSX to NSKeyedUnarchiver iOS
That's a good idea, i did not think of that, i could store the basic properties and rebuild it on the other side... a little more work but independent. thank you! Sandro. P.S. : I did look at the RTF Class from Omni, but it is tied to the framework and I did not want to include a framework for just a little fancy text. You might want to look into using a custom plist-based representation. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] UITableViewCell Height with UIWebView content
Greetings. I've been trying to set the table view cell's height for a custom tableviewCell containing a UIWebView to display attributed content but i cant's get the height properly. I am using a UITable View with sections, the first section shows a list of child objects and the second section displays the current node's text. Here is the explanation of my workout. yes it's a workout. 1: define a custom TableCellViewCell in interface builder, containing a UIWebView. 2: the UITableView is given a HTML String before being pushed on the Navigation view. 3: in the cellForRowAtIndexPath the cell is given the HTML String 4: i've also implemented the heightForRowAtIndexPath method. which calls a function that calculated the height of the cell using the text as source. - (CGFloat) heightOfCellForString:(NSString *)string inTableView:(UITableView*)tblView andFont:(UIFont *)font{ CGFloat minimumCellHeight = 44.0f; CGRect tableViewFrame = [tblView frame]; CGSize textSize = { tableViewFrame.size.width, 20.00f }; CGSize size = [string sizeWithFont:font constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap]; // if there is more than one line add a little padding.. if (size.height 21) size.height += 25; CGFloat result = MAX(size.height, minimumCellHeight); return result; } This function works great for ordinary cells, but falls verry verry short when it comes to resizing the cell containing the UIWebView, is there a effective way to tell how high the tableviewCell should be to accommodate the UITableCellView at the heightForRowAtIndexPath stage? since it is so tedious, Now i'm thinking this is a design flaw on my part, trying to resize a TableCellView with posibily big content. any advice? Best regards. Sandro Noel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] UITableViewCell Height with UIWebView content
Glenn thank you, I will revisit the design. as for using Core Text, I read the doc, but unfortunately for me I'm still novice at drawing stuff. I need to read more about it as it is the only way to get exactly what I want from the platform. so it is in the top of the todo list. best regards. Sandro. Rethink your design - putting a UIWebView inside a UITableView is usually a bad idea for a number of reasons, including: - not being able to tell the height of the view until far too late to be any good (UITableView needs to know before it is displayed, UIWebView can't know until after everything has been loaded) - views which scroll vertically inside other views which scroll vertically can cause a bad user experience (though at least as of 3.x they work - in previous OSes the results were far less useful), - UIWebView is a very heavy weight view, and UITableViewCells are designed to be light weight You should probably put the resulting UIWebView in its own view controller, and push that as a disclosure of the table cell (or detail disclosure). If your goal is just to display styled text inside a table row, you can use things like NSAttributedString/CoreText (or for pre 3.2 support, CFAttributedString custom drawing routines). Glenn Andreas gandr...@gandreas.com The most merciful thing in the world ... is the inability of the human mind to correlate all its contents - HPL ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
AttributedString from NSData on iPhone.
Hello. I'm trying to take an attributed string from a PDF document and reproduce it on the phone. passing thru a SQLite Database. basically, i write to the database using NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:NSRTFDTextDocumentType forKey:NSDocumentTypeDocumentAttribute]; [dict setValue:[NSNumber numberWithInt: NSUTF8StringEncoding] forKey:NSCharacterEncodingDocumentAttribute]; NSData *stringData = [[tempString dataFromRange:range documentAttributes:dict error:error] copy]; node.attributedStringData = stringData; *Node is my Managed Object Model entity, tempString is the attributed string from the PDF. So all the attributed strings get inserted into the database, and that database is sent to the iPhone Back on the iphone, I'd like to restore that attributed string from core data to an NSAttributedString object. and write that attributed string into a custom UITableViewCell, presumably using CoreText. any pointers on how that could be done? or am I over doing it and missed out on a cool class that does it all for me... as usual... best regards Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AttributedString from NSData on iPhone.
Kyle. What does it have support for? On 2010-08-05, at 12:00 PM, Kyle Sluder wrote: On Thu, Aug 5, 2010 at 8:16 AM, Sandro Noël apple.li...@gestosoft.com wrote: NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:NSRTFDTextDocumentType forKey:NSDocumentTypeDocumentAttribute]; iOS has no RTF support. You'll need to use HTML (but I have no idea if NSAttributedString on iOS will read HTML, either). --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AttributedString from NSData on iPhone.
David, you do understand properly as that was my question. how do i reassemble the NSAttributedString from a NSData where it was stored. On 2010-08-05, at 12:22 PM, David Duncan wrote: On Aug 5, 2010, at 9:00 AM, Kyle Sluder wrote: On Thu, Aug 5, 2010 at 8:16 AM, Sandro Noël apple.li...@gestosoft.com wrote: NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObject:NSRTFDTextDocumentType forKey:NSDocumentTypeDocumentAttribute]; iOS has no RTF support. You'll need to use HTML (but I have no idea if NSAttributedString on iOS will read HTML, either). It won't. iOS doesn't provide any parsers that generate an NSAttributedString from a file. My recommendation to Sandro (assuming I understand his situation) would be to store a representation of the NSAttributedString (probably as strings with matching attribute dictionaries) and reassemble the NSAttributedString from that at runtime. -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: AttributedString from NSData on iPhone.
Thank you david, I think i'll try serializing it and de-serializing it that should do the trick. Best regards. Sandro. On 2010-08-05, at 1:18 PM, David Duncan wrote: On Aug 5, 2010, at 10:13 AM, Sandro Noël wrote: David, you do understand properly as that was my question. how do i reassemble the NSAttributedString from a NSData where it was stored. That is the code you have to write basically. NSAttributedString has the methods you need for both getting and setting attributes and characters. You will have to use those methods along with your own storage scheme to save and restore the NSAttributedString. It primarily comes down to reading the documentation and asking more pointed questions if necessary :). -- David Duncan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Data protection clarification needed.
Graham thank you ! On 2010-08-03, at 1:46 AM, Graham Lee wrote: On 2 Aug 2010, at 18:37, Sandro Noël wrote: I suppose it might depend on what data you're talking about. If it's application configuration data, then it definitely should be backed up via the usual methods. If it's some kind of cache of data from an external source, then perhaps it doesn't need to be backed up. The data is definitely cached and it is not part of the settings I'm aiming at the data store. the application sync's the data from a in-house web service provider, and then stores it into a Core Data SQLite store. There is no need for that data to be backed up anywhere, as it is retrievable from the web service. the cached data is used for offline operations and later synced back to the web service. There are some locations you can write files that won't get backed up by iTunes (and when the content is recoverable as you say, it's fine to put the files in those areas). If you write to Library/Caches or tmp, you don't get backed up. Here's a link: http://developer.apple.com/iphone/library/documentation/iphone/conceptual/iphoneosprogrammingguide/RuntimeEnvironment/RuntimeEnvironment.html#//apple_ref/doc/uid/TP40007072-CH2-SW1 Cheers, Graham. -- Graham Lee http://blog.securemacprogramming.com/ Author - Professional Cocoa Application Security http://www.amazon.co.uk/gp/product/0470525959?ie=UTF8tag=thaeofer-21linkCode=as2camp=1634creative=6738creativeASIN=0470525959 ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] Data protection clarification needed.
Greetings. I've been looking for information on how the data protection works on the iPhone and I've watched the WWDC video session 209. but I might have misunderstood. what I understand is that the data is protected as long as the phone is locked. otherwise, it is accessible. with options of syncing that protected data to other devices. What we want is for out application Data to still be locked when the phone is unlocked and only unlocked by the user when the user logs locally in to the application. the data should not sync or be backed up onto any other device. it is after all strategic data, so we need to be really careful about it. is it at all possible to enable data encryption of our Core Data store independently of the user's unlock of the device and only make the data accessible when the application has authenticated the user, while still benefiting from the current (do not sync data) features of the current API implementation? I hope I'm being clear enough, my understanding is still a little blurry. Best regards. Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iPhone] Data protection clarification needed.
Hey Mark! Sorry for not being to clear, I'm doing my best. I suppose it might depend on what data you're talking about. If it's application configuration data, then it definitely should be backed up via the usual methods. If it's some kind of cache of data from an external source, then perhaps it doesn't need to be backed up. The data is definitely cached and it is not part of the settings I'm aiming at the data store. the application sync's the data from a in-house web service provider, and then stores it into a Core Data SQLite store. There is no need for that data to be backed up anywhere, as it is retrievable from the web service. the cached data is used for offline operations and later synced back to the web service. We want to control when the data becomes available in an unencrypted format. and that would be when our application is the active application, otherwise in the background or terminated, the data is encrypted and inaccessible. Thank you for taking the time, very appreciated! I hope this makes it more clear. best regards. Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [iphone] Hud style UIView
No one? On 2010-07-28, at 11:47 AM, Sandro Noël wrote: Greetings! my goal: prompt the user for a single line of text with a modal view containing a text field and the keyboard. the keyboard becomes visible as it should when the text field becomes first responder. What I've done is design the view in interface builder. and set the view colour to black with a 50% opacity. i've set the opaque property to NO; When I show the view on screen the transition is semi transparent black but when the view is finished transitioning it becomes gray instead of semi transparent letting the user see the table view in the background. is there something I'm forgetting? is there an action sheet that could achieve what i want to do? I've googled, but came up with no relevant result. Thank you for any pointer. Best regards. Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/apple.lists%40gestosoft.com This email sent to apple.li...@gestosoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iphone] Hud style UIView
Greetings! my goal: prompt the user for a single line of text with a modal view containing a text field and the keyboard. the keyboard becomes visible as it should when the text field becomes first responder. What I've done is design the view in interface builder. and set the view colour to black with a 50% opacity. i've set the opaque property to NO; When I show the view on screen the transition is semi transparent black but when the view is finished transitioning it becomes gray instead of semi transparent letting the user see the table view in the background. is there something I'm forgetting? is there an action sheet that could achieve what i want to do? I've googled, but came up with no relevant result. Thank you for any pointer. Best regards. Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: iPhone TabBarController and NavigationController with Core Data
please ignore: I've figured it out ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iPhone TabBarController and NavigationController with Core Data
Greetings. I've been at this for a week trying to figure things out and I'm getting nowhere. This is my first iPhone application so please be gentle. ok, I created the application from the tab bar application template, and checked core data stack support. created the model and imported startup data. Second I added navigation controllers to the Tab bar as seen in an example I've found on the internet or the apple documentation. I've connected all the nib files and the application works nicely when built and run in the simulator. The time has come to populate the table views and i'm completely confused on how to go about it. the layout, MainWindow.xib: Tab bar contorller Navigation controller View controller (loads SearchView) (other navigation controllers)... SearchView.xib: TableViewController (custom controller defined) TableView SearchBar now, inside the tableViewController i have a fetchResultController configured, but this guy needs a managedObjectContext which is in my Application delegate I've seen examples where the tableview exposes a property to set the local managedObjectContext but all the way back to the applicationDelegate is a place where no events happen where i can set the property on that specific TableViewcontroller. I'm sorry if i don't explain this correctly, i'm so lost i don't even know where to look now. looking at the examples (unless i've missed it) it seems i'm trying to so something extraordinary. or so easy there is no need for an example ( then i'm really off track ). Can someone please give me a pointer on how to get my managedObjectCOntect to my tableViewControllers? best regards. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SQLite Database 2 distinct database iphone.
Thank you Greg. Now i know it can be done. much appreciated! Sandro. On 2010-06-07, at 11:46 AM, Greg Reichow wrote: Greetings. I'm building a iPhone application which is database driven. in that application i've designed it to have two databases. One database will be distributed with the application and is meant to be read only. the second database is meant to copy items to it for the user's safe keeping. the reason for this is that the application update will also include a refreshed database and as such if i only link to the records it might happen that the record that the user wished to keep would of been purged from the original database. evidently the structure is quite the same on both, with the exception of some additional fields in the user database. when the application starts it complains that it can not merge the two models. i've been looking on the net but found nothing of significance. is it possible to have two separate database in the same application on the iphone. and what are the steps to make it happen. do i have to duplicate the Core data initialization procedures and maintain 2 distinct managed object contexts? I have a very similar application requirement. In my case, I am using 2 separate persistent stores. One is the user store located in their documents directory to maintain their unique copy of the database and edits to the provided data. The second is part of the application bundle. In this case, I use 2 separate MOC's and migrate data from the app persistent store to the user persistent store. Using the metadata that can be stored with the persistent stores, I check a version key I create and then if it is different, do a merge of the 2 stores. See the core data docs for a method for efficiently doing a large comparison and merge. This has worked quite well and allows for application database updates without messing up any unique changes the user has made to their own earlier copy. Doing it this way also protects the user if the application is reloaded. The user data in the documents directory is backed up and can easily be restored. As for model changes, if they are simple changes to the model between versions, you may be able to get away with lightweight migration. It is a simple option to add when loading the persistent store. There very well may be a better approach but this has successfully worked for me. Greg Reichow MangoCode ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
SQLite Database 2 distinct database iphone.
Greetings. I'm building a iPhone application which is database driven. in that application i've designed it to have two databases. One database will be distributed with the application and is meant to be read only. the second database is meant to copy items to it for the user's safe keeping. the reason for this is that the application update will also include a refreshed database and as such if i only link to the records it might happen that the record that the user wished to keep would of been purged from the original database. evidently the structure is quite the same on both, with the exception of some additional fields in the user database. when the application starts it complains that it can not merge the two models. i've been looking on the net but found nothing of significance. is it possible to have two separate database in the same application on the iphone. and what are the steps to make it happen. do i have to duplicate the Core data initialization procedures and maintain 2 distinct managed object contexts? thank you for any pointers. Best regards. Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Monitoring other application preferences changes
Are both of these applications yours? If so, then NSDistributedNotificationCenter is your friend. -- James Bucanek No unfortunately now, one of the is a apple system application. Thank you all for your valuable input. Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Removing item from CollectionView by drag it out.
I've added the --- protocol to my model but when i drag an item out of my frame I receive this stack trace. 'NSFilenamesPboardType' is not a valid UTI string. Cannot use an invalid UTI as a type returned from -writeableTypesForPasteboard: in class DockItem. Proposed Index : 1606412160 Now i see hat drag and drop has changed a little from 10.5 to 10.6 10.6 introduces types replacement for many of the 10.5 drag Types with system UTI's what is the proper replacement UTI for NSFilenamesPBoardType cheers. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Monitoring other application preferences changes
If I remember correctly, the Apple application you're interested in is the Dock. As I mentioned previously, you'll receive NSApplicationDidChangeScreenParametersNotification notifications (and -applicationDidChangeScreenParameters: delegate method invocations) when the Dock's position or size changes in such a way that the visible frame of one of the screens changes. Otherwise, what you're trying to do is unsupported. However, you can still use NSDistributedNotificationCenter to learn the undocumented, unsupported, unreliable distributed notifications that Apple is using to broadcast the changes in its preferences. Just register yourself as an observer of all distributed notifications and log them. Then, poke at the Dock's preferences in System Preferences and/or the Dock's contextual menu. You'll see the distributed notifications go by. Whether you want to base a commercial product on such unreliable Apple-private mechanisms is a judgment call. Regards, Ken Ken the Dock is one of the applications I wanted to monitor, thank you for the valuable pointers, Most appreciated! cheers! Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Removing item from CollectionView by drag it out.
So should I understand that NCCollectionView as a Drag Source is Broken enough for no one in this list to pay it attention? Has anyone got it working? I'm Confused. Drop destination works like a charm for me, just by implementing the NSCollectionViewDelegate protocol as part of my window controller the delegate being set for the Collection view in interface builder as the window controller. There are also methods for the drag Source but i can't seem to get them working properly. I can drag my item from the CollectionView to another CollectionView, the drop get's accepted but then, i get an error about URL's, i've never asked for URL's as a mater of fact my destination accepts only one type. NSFilenamesPboardType which is an array of strings containing file path. that is exactly what i construct to past to the pasteboard as so. - (BOOL)collectionView:(NSCollectionView *)collectionView writeItemsAtIndexes:(NSIndexSet *)indexes toPasteboard:(NSPasteboard *)pasteboard{ ENTERING(); [pasteboard clearContents]; [pasteboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil]; // we only allow one object to be selected. DItem *object = [[itemsArrayController selectedObjects] objectAtIndex:0]; [pasteboard writeObjects:[NSArray arrayWithObject:object.path]]; return YES; } [30040:a0f] Looked for URLs on the pasteboard, but found none. any clue is welcome. thanks Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Monitoring other application preferences changes
Greetings. I'm trying to figure out how to monitor the preferences changes in another application's preferences I would like my application to react to changes made in another application settings by the user. besides reloading the plist on a schedule is there a better way? ( I don't like this ) if there is a way to KeyValue Observe it that would be dandy. Can anyone point me in the right direction ? Regards. Sandro Noel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Removing item from CollectionView by drag it out.
Greetings I've been looking at Collection View Drag and drop, I've implemented the NSCollectionViewDelegate and now I can Drop items in and everything works fine. I've been looking at removing items from the collection view by dragging them out of the frame. I'm confused by the proper procedures. writeItemsAtIndexes happens just before the item is dragged and just after canDragItemsAtIndexes returns YES. How would i go about it ? 1: when the item is dragged out of the frame, I want to remove it from the collection view as to show that I am holding the item out of the collection ( i got it in my hands and it's in limbo ) 2: I could at any point drop the item back on the collection view as to cancel the deleting of the item 3: I could drag the item to another collection view in the same application as to move the item around. 3: if the item is released outside of any collection view it is lost (deleted). if anyone can point me to a good example, that would be great. Cheers! Sandro___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dock position and size
Greetings. Is there a way to determine the dock position on screen (left, right, bottom) and it's (width - height) ? thank you! Sandro Noël ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dock position and size
the reason why i want to know the position of the dock is because i want to latch on to it, over it. and i would like to be of the same width and same proportions. I guess i can calculate the height and the width according to the tilesize in the Dock preferences file. Sandro Noël On 2010-02-14, at 1:37 PM, Steven Degutis wrote: The only ways I can think of are through the Accessibility API (which must be enabled in the user's System Preferences for this to work) or by asking com.apple.dock.plist ... though, generally this kind of thing is not necessary (which explains why there is no formal API for it). I would suggest looking into alternatives like hiding the Dock and Menu Bar from the user, if that's your concern. -Steven On Sun, Feb 14, 2010 at 1:10 PM, Sandro Noël sandro.n...@gestosoft.com wrote: Greetings. Is there a way to determine the dock position on screen (left, right, bottom) and it's (width - height) ? thank you! Sandro Noël ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com This email sent to steven.degu...@gmail.com -- Steven Degutis http://www.thoughtfultree.com/ http://www.degutis.org/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dock position and size
Well the application I'm trying to do is a something I like to call a Dock-Stack. No it's not like those folders stacks. It's docks that would autohide and appear right under the dock window, but pop up just above the current dock. kind of an extension to the dock. (in the case my application is configured to be on the same screen edge as the OS Dock) I love the Dock but I find it limited. I've always wanted to have the option to have multiple docks live. without having to change the configuration like other applications offer, I want to have another dock either as a stack or as an independent one on other screen edges. and i have not found an application that does it like i want it to be. So i'll do it :) Voila. the secret is out. Sandro Noël On 2010-02-14, at 8:48 PM, Matthew Lindfield Seager wrote: On 15 February 2010 11:03, Sandro Noël sandro.n...@gestosoft.com wrote: the reason why i want to know the position of the dock is because i want to latch on to it, over it. I might be wrong and you may have a great reason for wanting to do this but it doesn't seem very Mac-like... There's possibly (probably?) a better way to design your interface that doesn't require latching on to the Dock. Remember: - the dock may be on the left, right or bottom of screen (or even the top of screen for those who like messing about with unsupported preference settings) - the dock may be set to auto-hide - the dock may be set to grow when the mouse moves over it (will your window resize every time these users mouse over the dock)? - the dock will grow and shrink as apps are added/removed/launched/quit - the dock will grow and shrink as windows are minimised and restored - users can (and will) resize the dock on a whim - users can (and will) change their dock hiding settings regularly (particularly those on lower res screens such as laptops or older machines) Of course if you're just trying to do this for an app for yourself go nuts! Matt ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dock position and size
This sounds like a pretty challenging task, especially given the fact that the Dock itself is so tightly coupled with many other OS X technologies (Spaces, Exposé, etc). Probably the closest utility to achieving this goal and still maintaining compatibility with these OS X niceties is Docks, formerly distributed by Thoughtful Tree Software and soon by Big Nerd Ranch. (There are other similar utilities, but I recommend Docks, on the basis that I wrote it and am thus biased.) But by all means if you want to try and write a new solution, go for it. Just remember how tightly integrated into OS X the Dock is, because a lot of people count on that fact. -Steven The approach of your project is very original, switching docks while switching spaces is a great feature. unfortunately not what I am trying to achieve, I'm extremely lazy clicker, I do not want to have to remember in what configuration of the dock I placed this and that application. I want them in my face all the time. I understand that not all user have a need for such a thing or screen real-estate, but I do. I think I found my solution, there is a way to guess the dock width it heroic but :) width = tilesize * (items in he dock) + (width of separator [scaled proportional to height of separator] ) + (tile separation pixels)) height = screen frame - visibleFrame if i recalculate it every time the window is shown i should be close to the spot most of the time. the zoom of the dock is irrelevant as it does not change the visible frame. any comments are welcome. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSDrawNinePartImage not working ?
Ok I know I must be missing something dumb. i'm trying to draw borders for the window, - (void) awakeFromNib{ [window setStyleMask:NSBorderlessWindowMask]; [window setOpaque:YES]; NSDrawNinePartImage([[window contentView]frame], nil, nil, nil, [NSImage imageNamed:@right3.png], nil, [NSImage imageNamed:@left3.png], [NSImage imageNamed:@right4.png], [NSImage imageNamed:@left5.png], [NSImage imageNamed:@left4.png], NSCompositeClear, 1.0, NO); but i get an error on runtime. Error: CGContextGetStyle: invalid context 0x0 It does not make sense to draw an image when [NSGraphicsContext currentContext] is nil. This is a programming error. Break on _NSWarnForDrawingImageWithNoCurrentContext to debug. This will be logged only once. This may break in the future. CGContextClipToRect: invalid context 0x0 Error: CGContextSetAlpha: invalid context 0x0 Error: CGContextGetUserSpaceToDeviceSpaceTransform: invalid context 0x0 Error: CGContextDrawTiledImage: invalid context 0x0 Error: CGContextClipToRect: invalid context 0x0 Error: CGContextSetAlpha: invalid context 0x0 Error: CGContextGetUserSpaceToDeviceSpaceTransform: invalid context 0x0 Error: CGContextDrawTiledImage: invalid context 0x0 I looked in the docsa little but did not find any indication that i had to provide a Graphics context. any pointers ? Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDrawNinePartImage not working ?
You should be drawing from drawRect:, not awakeFromNib. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ CocoaDrawingGuide/Introduction/Introduction.html Also, IIRC, you can only make a window borderless at init time. Are you trying to make a custom window? Google must have examples of that... Sean Sean, Graham. thank you i'll look that up. cheers. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting system protected folders.
Is there anything in Cocoa/Carbon to retrieve ACL From files? Or do i have to mess around with the ACL Library directly ? Regards. Sandor Noel. On 2009-12-19, at 12:27 PM, Sandro Noël wrote: Testing this in Terminal: mv ~/Music ~/lose I get a Permission denied error message, which suggests an ACL. It's confirmed by this command: ls -led ~/Music Based on this, my new guess is that NSFileManager isn't using the ACL to check for writability. You may want to look at other NSFileManager methods, or look into other ways to read the ACL. Greg, thank you for the pointer. Regards. Sandro noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/sandro.noel%40gestosoft.com This email sent to sandro.n...@gestosoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Outline View Enter Edit Mode.
Greetings This is probably a simple question. How do you tell an Outline View item to enter edit mode from a pop up menu. Just like when i double click on it? I Looked Around, but when i call the Edit Message, i get an error that it is an unknown selector. any clues? regards. Sandro Noel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting system protected folders.
Testing this in Terminal: mv ~/Music ~/lose I get a Permission denied error message, which suggests an ACL. It's confirmed by this command: ls -led ~/Music Based on this, my new guess is that NSFileManager isn't using the ACL to check for writability. You may want to look at other NSFileManager methods, or look into other ways to read the ACL. Greg, thank you for the pointer. Regards. Sandro noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Detecting system protected folders.
Hello In an OutlineView, listing the content of the hard drive. there are some system protected folders that will not allow themselves to be renamed. I would like to disable the possibility of even starting to edit there names in my interface. I would need a function that can tell me if the folder I'm trying to rename is actually a system protected folder. then I can block the operation before it starts in my delegate. is there such a thing? Regards. Sandro.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Outline View CancelEditing
Hello In an outline View, listing the content of a directory with a custom Image/Text cell I would want to react to the ESC key press to cancel the current editing operation. Using my OutlineView Controller Delegate I can receive the notification that NSResponder's cancelOperation(esc) has been called. But how do I actually cancel the editing operation? Regards. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Outline View CancelEditing
The esc Key is trapped like this inside the View controller that is loaded inside the window. -(BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command { if (command == @selector(cancelOperation:)) { NSLog(@escape key has been pressed); } return NO; } I do not have access to the window instance. How do i get to the window? On 2009-12-18, at 9:48 AM, Graham Cox wrote: On 19/12/2009, at 1:35 AM, Sandro Noël wrote: But how do I actually cancel the editing operation? Just make the outline view itself first responder. This will validate and resign the text field if it's OK. [[outlineView window] makeFirstResponder:outlineView]; --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting system protected folders.
On 2009-12-18, at 12:25 PM, Jens Alfke wrote: On Dec 18, 2009, at 6:12 AM, Sandro Noël wrote: there are some system protected folders that will not allow themselves to be renamed. I would like to disable the possibility of even starting to edit there names in my interface. I would need a function that can tell me if the folder I'm trying to rename is actually a system protected folder. Use NSFileManager to check whether you have write access to the directory and its parent directory. —Jens Jens, thank you, I ha thought about it but i thought it was to simple. cheers. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting system protected folders.
On 2009-12-18, at 1:11 PM, Sandro Noël wrote: On 2009-12-18, at 12:25 PM, Jens Alfke wrote: On Dec 18, 2009, at 6:12 AM, Sandro Noël wrote: there are some system protected folders that will not allow themselves to be renamed. I would like to disable the possibility of even starting to edit there names in my interface. I would need a function that can tell me if the folder I'm trying to rename is actually a system protected folder. Use NSFileManager to check whether you have write access to the directory and its parent directory. —Jens it does not work, even if i select the root folder of my hard drive i still get the permission to rename it. BOOL valid = [[NSFileManager defaultManager] isWritableFileAtPath:[node.nodeURL path]]; BOOL validParent = [[NSFileManager defaultManager] isWritableFileAtPath:[[node.nodeURL URLByDeletingLastPathComponent]path]]; return (valid validParent); Any other ideas?___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting system protected folders.
On 2009-12-18, at 3:25 PM, Greg Guerin wrote: Sandro Noël wrote: it does not work, even if i select the root folder of my hard drive i still get the permission to rename it. What effective user id is it running as? What groups is that user id a member of? Run this Terminal command to identify the user: id -p uid snoel groups staff _developer _lpoperator _lpadmin _appserveradm admin _appserverusr localaccounts everyone com.apple.access_screensharing Run this Terminal command to examine permissions: ls -ld / drwxrwxr-t 31 root admin 1122 18 Dec 20:32 / If the code isn't doing what you want, then please explain more precisely what you want to happen. Give examples. Well for instance if I try to rename the music folder in my personal home folder using Finder The system/finder will not let me do that because the folder is needed by the system. The cell never enters edit mode. I can however write to these folders as I am the owner I want to reproduce the same functionality. cheers, Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Outline View.
Greetings. I was wondering if anyone had a good example or post for the Dreaded Outline View. I'm trying to list the content of a directory but i'm having problems understanding the model. i have to feed the view. I've ran across a couple of examples but they all mix up my mind. there all adding extra features like drag and drop and source view custom cell view's ... i need a plain and simple explanation on the model i have to produce to get it to list the content of a folder, using bindings or not. thank! Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Outline View.
On 2009-12-03, at 11:07 PM, Graham Cox wrote: http://apptree.net/gcfolderbrowser.htm hth, --Graham Graham thanks for the link, the component is deprecated thow. but it's a good enough example. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Apple MVC and Document Based application confusion.
Hello. I'm reading COCOA Design Patterns from Eric M. Buck Donald A. Yacktman. and i'm having a hard time applying the principle in my architecture. for example, if i create a new document based application in XCode, the MyDocument xib file binds the window outlet to the MyDocument Class. From what I read the MyDocument Class is supposed to be a model controller, not the window controller. The MyDocument Class is supposed to be able to host an array of window controllers. I see that makes sense if I have a main data view window and I would want to associate an inspector to that window and share the same data source with both windows. and I like that idea. what i am unsure of is how to go about with interface builder, and where should i associate the view with it's controller inside the MyDocument Class? ( but i read that model should have no knowledge of the view) is it the same for the Model Controller? if it's not then MyDocument Class becomes more than a Model Controller it is also a Window controller. in witch case why bother creating separate View/Window controllers? and why host an array of window controllers? Do i create the Window controllers in IB or do i do it in code, and how would i go about doing that the right way? I'm kind of confused and I'd really love some clearing up. thanks for any pointers. Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Apple MVC and Document Based application confusion.
On 2009-11-29, at 8:18 PM, Graham Cox wrote: On 30/11/2009, at 12:04 PM, Jason Stephenson wrote: NSDocument and the document-based architecture in Cocoa is a bad example of MVC. As a statement that doesn't really stand up to scrutiny. Sure, you can abuse NSDocument and violate MVC, but as it comes it does not. A document might own (or be) the data model, and it might also keep a list of window controllers. How does that violate MVC? NSDocument is just 'M', and nothing more. --Graham Graham. I have to agree with you here, NSDocument should be just M in the MVC Pattern, but why is XCode evidently binding it as the C also in the template project. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Apple MVC and Document Based application confusion.
Thank you all, it cleared things up quite a bit. Best regards. Sandro. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Custom Controls Where to start
Hi all, I'm trying to educate myself on how to create my custom controls/Views. Everywhere i look no one uses the same methods to override drawing and behaviour. and most of the example do not start from the same place, Some start from NSControl with a combination of NSCell and NSActionCell Others Start from NSView, and some start from Apple's controls and override the drawing. What i am trying to achieve is 1: to be able to change the look of the controls that already exist if i need to. 2: if I have the need for a control that does not exist, i want to be able to create it myself. including having to respond to user input and mouse clicks and send those back to the caller ( thru delegates or actions ) thank you for any pointers. Sandro Noel.___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: show selected image in a segmented control
On 2009-11-26, at 2:04 PM, Pierre Berloquin wrote: Hi I'm using a segmented control with four segments. I initialise it with four images. It does display the images perfectly but ... it doesn't show which image is selected. How can I highlight the selected segment/image? Should I provide two images for each segment? But how? Thanks Pierre I would use a different image for every state. in your action handler - (IBAction)segControlClicked:(id)sender { int clickedSegment = [sender selectedSegment]; int clickedSegmentTag = [[sender cell] tagForSegment:clickedSegment]; // replace your image here [segControl setImage:[your image] forSegment:clickedSegment]; // do not forget to manage the images of the not clicked segments back to original. } regards. Sandro Noel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom Controls Where to start
Thank you Alastair. Well it's pretty complicated, This is my third application, the first being Bonjour Mounter, the Second RDP Launcher. Others were created but never released. I've always used the OS's controls but now I find myself frustrated with the limits of these controls in terms of looks. I see other application makers producing great looking applications with custom looking views and controls. So I want to be able to know where to start and what to think about when I create a control, a view. I did venture to read the Doc documentation, there is much there but so much it becomes confusing. for example, the look of the segment control does not fit the look that i'd like it to have, i find it's a good enough starting point to create a tab bar, a little like Safari, and add the close tab button and some status information on the right end of the tab. along with a scrolling title like on the Apple TV. From what I understand, all I would have to do is create my own cell. Also, the controls for the HUD panels are missing, there is BWHUDAppKit.framework that does partial of the work witch is amazing. but it is not complete, i like to use the CollectionView control, and it hans not been implemented, so i'm off to do it myself. there are also table cels missing, i would like to create those too. I think that once I've done these I would pretty much be able to create my own out of this world looking controls while preserving HIG intact. and it will also give me a better understanding of the underpinnings of cocoa. I also want to write a control/view that incorporates some of the features of most code editors, code folding, code colouring and such out of the box. but that is not for now. Sandro. On 2009-11-26, at 5:20 PM, Alastair Houghton wrote: On 26 Nov 2009, at 18:22, Sandro Noël wrote: I'm trying to educate myself on how to create my custom controls/Views. Everywhere i look no one uses the same methods to override drawing and behaviour. and most of the example do not start from the same place, :-) There are, as you have noticed, several approaches that work, depending on what you're doing and what you hope to achieve. Some start from NSControl with a combination of NSCell and NSActionCell Yep. Others Start from NSView, and some start from Apple's controls and override the drawing. Yep. What i am trying to achieve is 1: to be able to change the look of the controls that already exist if i need to. In which case you'll have to look how the control in question is implemented. If it's an NSControl subclass, you probably need to subclass the corresponding NSCell subclass in order to customise it. 2: if I have the need for a control that does not exist, i want to be able to create it myself. including having to respond to user input and mouse clicks and send those back to the caller ( thru delegates or actions ) If it smells like an NSControl (e.g. a button or something), then using a custom cell is probably the best way to go. Especially if there's already a matching subclass of NSControl (e.g. NSButton), in which case you can subclass NSButton and NSButtonCell and get most of the existing button functionality for free. If it doesn't look like that, for instance it's some new control that the system doesn't have, or it's the main document view of your app or something, then NSView is probably a better bet. NSControl and NSCell have the advantage that they do various things for you, *and* you can create an NSMatrix of your new cell class, or stick it into an NSTableView. If you're using a custom NSView, it's harder to put it into a table view, and you have to handle everything directly yourself, but, on the other hand, you only have to write one class and it's perhaps slightly more apparent how to handle e.g. mouse events than it is with NSCell (I know that's something I struggled with at first). I'll also add a warning. While you can create custom controls, it's important to consider carefully whether they're necessary. Making controls that look or work in a manner that doesn't match those in the HIG is probably a mistake, unless you have a good justification for it (and looks/works like Windows, although a common justification, is wrong). If you want more specific advice, you'll have to be more specific about what you want to achieve. Kind regards, Alastair. -- http://alastairs-place.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: show selected image in a segmented control
On 2009-11-26, at 11:02 PM, Jerry Krinock wrote: On 2009 Nov 26, at 11:04, Pierre Berloquin wrote: I'm using a segmented control with four segments. I initialise it with four images. It does display the images perfectly but ... it doesn't show which image is selected. I use segmented controls with images and do not have this problem. The selected segment is given a blue-ish background.\ For more evidence, if you have Xcode in all-in-one view, look at the segmented control in the left side of the toolbar which shows project vs. debug icons. Note that the selected one turns gray-ish. that depends if your segmented control in Interface builder has a mode of select one. if it is select any or select none, the segmented control will not show the selection. best regards. Sandro ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where are the interface builder components?
OK, so you want one of these controls yourself? Well, let's imagine you're going to sit down and write one for your app. Are you honestly telling me that you expect to end up with highly reusable code that could be placed in a framework like Cocoa, and you'd be happy to ship to a large number of other developers? Or (and far more likely) that you'll have implemented only the bits of functionality your own app needs and left plenty of holes to fill? Please i'm not trying to offend anyone here, i was just questioning... but since you ask. I try my best to design my classes with the re-usability in mind, also to the best of my knowledge of the language at the time of design, mostly because I do not like to have to rewrite things, it's a waste of time, efforts and money... occasionally I will rewrite a class to improve it with new acquired knowledge and techniques yes, for instance when i learned that i could iterate thru a collection using a for loop instead of while loop coupled with an iterator, i did change most of my classes to reflect that ease of use. same thing for when I learned of properties and KVM coding. Additionally I always write my code with someone might need to use this kind of approach, it takes me a little more time but it's worth it in the end. If I was to provide quality development tools to my users, I would make sure my employees have that mindset when hacking together a class, yes, because the time spent un-mixing the mess afterwards to release proper components is just to costly. 1: it takes them away from the creative bench to think of new features 2: it doubles the initial effort therefor doubling the cost, in human hours. Unfortunately for me right now i do not believe I have proper and all the handles on cocoa to create my own controls, but i'm getting there My first controls will probably have holes and missing features, and might respond to specific needs, but then again i'm one guy with less than a year of experience with cocoa. Tho I try my best to measure up, I'm not Apple. This thread of emails want not intended to bash Apple for not doing their work, I just needed to understand why the components are not already available in the toolbox when it seemed logical to me that they should of been there with the release of the operating system along with all the new features so application developers could take full advantage of it. Thank you all for your feedback and explanations! As usual this community Rocks! Cheers. Sandro Noel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where are the interface builder components?
This is what i think from observing the applications apple released witch have controls that are not in the tools palette. * Must work with localized content That's already implemented in the controls used by apple in their application. * Must work with accessibility also already implemented in the controls used by apple in their application (for the most part). * For particular controls, probably need to have multiple sizes (large, small, mini) already implemented visibly in the controls used by apple in their application. * Probably will need to expose custom bindings Apparently iLife and most of the released applications with snow leopard are coded in cocoa, the finer for example is now a cocoa application, * Should work in resolution independence. That i'm not sure of, but considering that Binary God ( BGHUDAppKit) was able to do it properly i imagine the brains at apple can do as much, * Probably some other things I'm missing. Maybe i'm just talking out of my hat here, because i'm not in the secrets of the gods, but looking at what is in the applications already... I'll file a request. thank you for the advice! Sandro. On 2009-11-17, at 4:40 PM, Ricky Sharp wrote: On Nov 16, 2009, at 9:28 PM, Sandro Noël wrote: I guess i'll have to make my own. I just find it sad to have to duplicate work, it's unproductive. True, but keep in mind the amount of effort that Apple would need to do if they provided the custom control, etc: * Must work with localized content * Must work with accessibility * For particular controls, probably need to have multiple sizes (large, small, mini) * Probably will need to expose custom bindings * Should work in resolution independence. * Probably some other things I'm missing. Definitely file an enhancement request though. I'm sure Apple will strongly look into providing something if several developers end up asking for the same type of controls. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where are the interface builder components?
Thank you all for your feedback! I guess i'll have to make my own. I just find it sad to have to duplicate work, it's unproductive. cheers! Sandro Noel. On 2009-11-16, at 11:53 AM, Scott Ribe wrote: But where are the ones from apple... that's what i'm wondering, Why do we have to duplicate work that evidently has already been done. I'm confused as why apple is not including it in it's development tools. it makes no sense to me... Because it takes longer to release new UI widgets as general-purpose tools than it does to create them in isolation in a single app? Because it takes more work to create a widget + an IB plug-in that it does to code up the widget in an app? New plug-ins *have* been added to IB some time after widgets show up in Apple apps (toolbars come to mind), but Apple can't do everything at once and they're certainly not going to hold up shipping new features in iWhatever just because you'll want the IB plug-in at the same time. Any particular widget you have a need for, file an enhancement request... -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Where are the interface builder components?
Greetings. I'm kind of annoyed with the 1867 A.D. controls that are in interface builder. Every time i want to do something visually cool, I can see the lines of code piling up I'm wondering where all the good stuff is, (interface builder components) Evidently Apple has some cool components in their library, for example the Hud controls. The safari tabs, toolbar controls with multiple view's Where can I get my hands on that? Is it part of the ADC Membership? Do I have to learn to code these wonders by hand? Am I missing something fundamental? Something I should read up to get satisfaction in my creative adventures? Thank you for any pointers. Sandro Noël ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Where are the interface builder components?
Dave Wow, cool Link, thank you! very appreciated! But where are the ones from apple... that's what i'm wondering, Why do we have to duplicate work that evidently has already been done. I'm confused as why apple is not including it in it's development tools. it makes no sense to me... Sandro Noel. On 2009-11-14, at 8:40 PM, Dave DeLong wrote: There are a bunch of freely available frameworks that have UI elements like that, such as BWToolkit, BGHudAppKit, AmberFramework, iLife Controls, HMBlkAppKit, and more. Here's a decent list: http://cocoaheads.byu.edu/resources/user-interface Cheers, Dave On Nov 14, 2009, at 6:35 PM, Sandro Noël wrote: Greetings. I'm kind of annoyed with the 1867 A.D. controls that are in interface builder. Every time i want to do something visually cool, I can see the lines of code piling up I'm wondering where all the good stuff is, (interface builder components) Evidently Apple has some cool components in their library, for example the Hud controls. The safari tabs, toolbar controls with multiple view's Where can I get my hands on that? Is it part of the ADC Membership? Do I have to learn to code these wonders by hand? Am I missing something fundamental? Something I should read up to get satisfaction in my creative adventures? Thank you for any pointers. Sandro Noël ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/sandro.noel%40gestosoft.com This email sent to sandro.n...@gestosoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
FSMountServerVolumeSync Authentication problem
Greetings. I'm having some problems with FSMountServerVolumeSync authentication on some leopard systems since i compiled my application on snow leopard. machines trying to mount shares off other machines in AFP mode return error -5002 SMB, FTP, CIFS, HTTP still work just fine i did not find any relevant documentation on the internet, and if i try to mount the share with finder all is working ok. does anyone have a hint for me ? i can provide code. thank in advance. Sandro Noël ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com