Re: Stupid objective-c question

2016-09-23 Thread Graham Cox
> On 24 Sep 2016, at 12:13 PM, Uli Kusterer > wrote: > >> I expect the first thing -isEqualToString: does is a pointer comparison, so >> it’s unlikely to be significantly less performant for the case of when the >> pointers are literally identical. > > No, Graham, don't do that! > > There i

Re: How to update UI from a background thread

2016-09-23 Thread Uli Kusterer
On 21 Sep 2016, at 18:20, Dave wrote: > This doesn’t work probably because the Class is that is calling back the > delegate method that updates the Scroll View is also being run on the main > thread. Sorry I should have said this earlier. I tried updating the UI on a > background thread and it

Re: Modern API to read textClipping files

2016-09-23 Thread Uli Kusterer
On 23 Sep 2016, at 08:49, Allan Odgaard wrote: > Is there any non-deprecated API to read textClipping files? > > FSOpenResFile() was deprecated in 10.8 but I haven’t found a way to replace > it. There is the com.apple.ResourceFork extended file attribute, but it seems > to be stored in some leg

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
On 23 Sep 2016, at 01:19, Sandor Szatmari wrote: > // my .m file > static NSString * const kMyContext = @"my fantastic context"; This avoids the issue of having a different string in a different module and relying on details of your compiler and its optimizer. However, it can still run afoul o

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
> On 23 Sep 2016, at 01:07, Quincey Morris > wrote: > > On Sep 22, 2016, at 15:45 , Gabriel Zachmann wrote: >> >> Sure, but an observation method is what would be called a "callback" in >> plain C. >> In C, I can have many different callbacks. >> I don't see why that should not be possible i

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
On 23 Sep 2016, at 00:45, Gabriel Zachmann wrote: >> Because the observer is an object. Your observation and a superclass >> observation come from the same object. Whether these are to be treated as >> different observations** cannot be determined automatically, hence the need >> for a “context

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
> On 22 Sep 2016, at 19:53, Quincey Morris > wrote: > > On Sep 22, 2016, at 03:16 , Gabriel Zachmann wrote: >> >> That makes me wonder: why isn't it possible to register several, different >> observers for the same thing? >> That way, I wouldn't need to care about observations I didn't creat

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
On 22 Sep 2016, at 04:00, Doug Hill wrote: > As to the context type, I would be interested to know of cases where the > observer doesn't have control over the context. As your quote says: > "Contexts chosen in a similar manner in the super- or subclass will be > unlikely to overlap." It is

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
> On 22 Sep 2016, at 03:36, Graham Cox wrote: > > >> On 22 Sep 2016, at 10:40 AM, Quincey Morris >> wrote: >> >> On Sep 21, 2016, at 17:01 , Graham Cox wrote: >>> >>> This should be: if([(NSString*)context >>> isEqualToString:@“mediaLibraryLoaded”])… >> >> Actually, this is not a good id

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
> On 22 Sep 2016, at 03:21, Slipp Douglas Thompson > wrote: > > >> On Sep 21, 2016, at 8:00 PM, Slipp Douglas Thompson >> wrote: >> >>> On Sep 21, 2016, at 17:01 , Graham Cox wrote: This should be: if([(NSString*)context isEqualToString:@“mediaLibraryLoaded”])… >>> >>> Ac

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
> On 22 Sep 2016, at 02:05, Gabriel Zachmann wrote: >> >>> how can the compiler know that '==' in this case is a NSString comparison? >> >> It can’t because it isn't. What’s being compared are raw pointers. The >> string value is irrelevant. > > Let me try to paraphrase, in order to check whe

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
On 22 Sep 2016, at 02:02, Doug Hill wrote: >>> My question is: how can the compiler know that '==' in this case is a >>> NSString comparison? >>> Or is some other magic going on here? if so, which? >>> Does the compiler know it should perform some kind of dynamic method >>> dispatch? >> >> My g

Re: Stupid objective-c question

2016-09-23 Thread Uli Kusterer
> On 22 Sep 2016, at 02:01, Graham Cox wrote: > > >> On 22 Sep 2016, at 9:44 AM, Gabriel Zachmann wrote: >> >> I have found on the net > > That isn’t always a recommendation ;) > > >> if ( context == (__bridge void *) @"mediaLibraryLoaded" ) Gabriel, this is a pointer comparison, not a

Re: CALayer kCAGravityResizeAspectFill and kCAGravityTop

2016-09-23 Thread Torsten Curdt
> > > Its still an option, especially if you are otherwise using UIViews – > UIView.maskView would do the trick. > Wow - I wasn't even aware that exists. Nice! Thanks! ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin req

Re: IKImageBrowserView keeps scrolling to the bottom

2016-09-23 Thread Steve Mills
On Sep 23, 2016, at 15:05:38, James Crate wrote: > > I thought the same thing. I haven’t installed Sierra yet, so maybe it works > if you build with Xcode 8 on Sierra. For now, if you go back to Xcode 7 it > will should work like before, but I haven’t tried that yet either. I needed > Xcode 8

Re: IKImageBrowserView keeps scrolling to the bottom

2016-09-23 Thread James Crate
On Sep 23, 2016, at 1:35 PM, Steve Mills wrote: > > On Sep 23, 2016, at 12:21:56, James Crate wrote: >> >> I saw the same thing when I updated to Xcode 8 last week. A sample app with >> no subclassing displays the same behavior. I filed a radar with sample >> project as well. >> >> The docu

Re: IKImageBrowserView keeps scrolling to the bottom

2016-09-23 Thread Steve Mills
On Sep 23, 2016, at 12:21:56, James Crate wrote: > > I saw the same thing when I updated to Xcode 8 last week. A sample app with > no subclassing displays the same behavior. I filed a radar with sample > project as well. > > The documentation for IKImageBrowserView now says it is effectively

Re: IKImageBrowserView keeps scrolling to the bottom

2016-09-23 Thread James Crate
On Sep 23, 2016, at 1:01 PM, Steve Mills wrote: > > I just noticed that the most recent build of my app was scrolling the image > browser view constantly to the bottom. I can scroll up once it gets to the > bottom, but it then scrolls back down. I can change the sort order, but it > keeps scro

IKImageBrowserView keeps scrolling to the bottom

2016-09-23 Thread Steve Mills
I just noticed that the most recent build of my app was scrolling the image browser view constantly to the bottom. I can scroll up once it gets to the bottom, but it then scrolls back down. I can change the sort order, but it keeps scrolling to the bottom no matter what. I have it subclassed, bu

Re: iOS Application influencing a running web app?

2016-09-23 Thread Pascal Bourguignon
A web application has a bunch of urls, each connected to a different function. Define an url to set a parameter and connect it to the function that sets this parameter. Use this url only in the iOS application. You may want to use some authentication protocol to authorize the parameter setting,

Re: iOS Application influencing a running web app?

2016-09-23 Thread Eric E. Dolecki
Thanks for your reply. I'm not sure I'm following, though. Do you mean to send it query strings? I could make the HTML page of the app a PHP page. If that's what you meant. Eric On Fri, Sep 23, 2016 at 10:42 AM Pascal Bourguignon wrote: > Just write some http app on the laptop, and hit it with

Re: iOS Application influencing a running web app?

2016-09-23 Thread Pascal Bourguignon
Just write some http app on the laptop, and hit it with requests (urls) from the iOS app; this would be the Q&D way to do it easily and with some level of security (https). Since you already have a web app, you can just add some admin requests to it. -- __Pascal Bourguignon__ > Le 23 sept. 2

iOS Application influencing a running web app?

2016-09-23 Thread Eric E. Dolecki
I am going to have a web application running on a local laptop - which runs various a prototype of a user experience. I've been asked to add an iOS application to the mix, to control parameters in the running app on the laptop. What might be the best way to architect this type of set up (and also

Re: Stupid objective-c question

2016-09-23 Thread Sandor Szatmari
Thanks to both of you for clarifying this and for a nice solution. Basically then, I must not use address pointed to, but instead, the address of the pointer itself. I liked the readability of using a string, but I think there is too much room for misinterpretation, conflating the contents of t

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 10:04, Quincey Morris wrote: > >> static void* kMyContext = &kMyContext; > > That makes the “&” optional (at comparison time), and it should even avoid > the coalescing problem if it’s declared const. Yes, that’s a good way to do it. It might be a good idea for Apple to ha

Re: Stupid objective-c question

2016-09-23 Thread Jonathan Mitchell
> On 23 Sep 2016, at 10:04, Quincey Morris > wrote. > > As previously mentioned, the safest way to do this is: > >> static void* kMyContext = &kMyContext; > Thats a neat trick. It’s not an initialisation that I have seen before and on first glance I thought it was a typo but it works. I norm

Re: Stupid objective-c question

2016-09-23 Thread Quincey Morris
On Sep 23, 2016, at 01:36 , Alastair Houghton wrote: > > Note that you can use *any* type for your variable; in some ways, it might > make sense to use a non-pointer type, just to make clear that it’s the > address that matters, e.g. > > static const int kMyContext = 0xabadf00d; > > Otherwi

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 09:36, Alastair Houghton wrote: > > Note that you can use *any* type for your variable; in some ways, it might > make sense to use a non-pointer type, just to make clear that it’s the > address that matters, e.g. > > static const int kMyContext = 0xabadf00d; On second tho

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 00:07, Quincey Morris wrote: > > On Sep 22, 2016, at 15:45 , Gabriel Zachmann wrote: >> >> Sure, but an observation method is what would be called a "callback" in >> plain C. >> In C, I can have many different callbacks. >> I don't see why that should not be possible in Obj

Re: Stupid objective-c question

2016-09-23 Thread Alastair Houghton
On 23 Sep 2016, at 00:19, Sandor Szatmari wrote: > > I wanted to get some opinions on the following which I have done in the past > and perceive as different because the string constant is introduced and > defined once and only once. > > // my .m file > static NSString * const kMyContext = @"m