MODERATOR: End of Thread (was Re: NSSavePanel?)

2014-03-06 Thread Chris Hanson
This is off-topic for cocoa-dev.

  -- Chris Hanson, cocoa-dev co-moderator

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: No longer existing outlet causes crash in new version of app (iOS)

2014-03-06 Thread Kyle Sluder
On Thu, Mar 6, 2014, at 04:25 PM, Koen van der Drift wrote:
> Just changing the name of the VC solved it.

Well, the old build compiled nib is still sitting in your build
products, so it didn't really "solve" anything.

> Will this be an issue with users when they update to the new version? I don't 
> want them having to delete the app and lose their data.

No. Unlike Xcode installs, App Store installs blow away the entire
application (but preserve the user's data).

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: No longer existing outlet causes crash in new version of app (iOS)

2014-03-06 Thread Koen van der Drift
Just changing the name of the VC solved it.

- Koen.


On Mar 6, 2014, at 7:18 PM, Koen van der Drift  
wrote:

> 
> On Mar 6, 2014, at 7:15 PM, Kyle Sluder  wrote:
> 
>> Delete the app from your device and rebuild. I'm guessing the XIB is
>> left over and has the same name as a UIViewController, but that view
>> controller is now trying to set up its view in code. Since Xcode never
>> deletes files from the build products unless you've done a clean
>> build—nor does it delete files from the app sandbox when copying to the
>> device—the framework can still find the XIB at runtime.
> 
> 
> Will this be an issue with users when they update to the new version? I don't 
> want them having to delete the app and lose their data.
> 
> Thanks,
> 
> - Koen.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: No longer existing outlet causes crash in new version of app (iOS)

2014-03-06 Thread Koen van der Drift

On Mar 6, 2014, at 7:15 PM, Kyle Sluder  wrote:

> Delete the app from your device and rebuild. I'm guessing the XIB is
> left over and has the same name as a UIViewController, but that view
> controller is now trying to set up its view in code. Since Xcode never
> deletes files from the build products unless you've done a clean
> build—nor does it delete files from the app sandbox when copying to the
> device—the framework can still find the XIB at runtime.


Will this be an issue with users when they update to the new version? I don't 
want them having to delete the app and lose their data.

Thanks,

- Koen.
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: No longer existing outlet causes crash in new version of app (iOS)

2014-03-06 Thread Kyle Sluder
On Thu, Mar 6, 2014, at 04:01 PM, Koen van der Drift wrote:
> I'm working on a new version of my app, and while testing it against the
> one that is now in the store, I'm running into an "*** Terminating app
> due to uncaught exception 'NSUnknownKeyException', reason:
> '[ setValue:forUndefinedKey:]: this class is
> not key value coding-compliant for the key graphSuperView.'" error when
> opening a viewController.
> 
> I know what this means and I think I know why this happens: in the
> previous version I had a xib for this viewController, with an outlet to
> 'graphSuperView'. However, while developing the next version, I took out
> that xib and the outlet, and am setting up the view completely in code. I
> did a text search through my whole project, but cannot find any
> references to that outlet, and the xib is no longer part of the project.
> 
> So my guess is that the app (the current release version) when it gets
> updated with the development version on my iPhone, still has a reference
> to that outlet, or even the xib, causing the crash.
> 
> 
> Any ideas how this can be fixed?

Delete the app from your device and rebuild. I'm guessing the XIB is
left over and has the same name as a UIViewController, but that view
controller is now trying to set up its view in code. Since Xcode never
deletes files from the build products unless you've done a clean
build—nor does it delete files from the app sandbox when copying to the
device—the framework can still find the XIB at runtime.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

No longer existing outlet causes crash in new version of app (iOS)

2014-03-06 Thread Koen van der Drift
I'm working on a new version of my app, and while testing it against the one 
that is now in the store, I'm running into an "*** Terminating app due to 
uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value 
coding-compliant for the key graphSuperView.'" error when opening a 
viewController.

I know what this means and I think I know why this happens: in the previous 
version I had a xib for this viewController, with an outlet to 
'graphSuperView'. However, while developing the next version, I took out that 
xib and the outlet, and am setting up the view completely in code. I did a text 
search through my whole project, but cannot find any references to that outlet, 
and the xib is no longer part of the project.

So my guess is that the app (the current release version) when it gets updated 
with the development version on my iPhone, still has a reference to that 
outlet, or even the xib, causing the crash.


Any ideas how this can be fixed?

Thanks,

- Koen.
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Greg Parker
On Mar 6, 2014, at 3:37 PM, Sean McBride  wrote:
> On Thu, 6 Mar 2014 15:15:49 -0800, Jens Alfke said:
>> I remember the “Month Of Apple Bugs”** that a hacker group ran in 2007,
>> where they published a new app or OS security vulnerability every day
>> for month. A lot of them were caused by format-string vulnerabilities.
>> Soon thereafter the compiler team at Apple added that format-string
>> security warning :)
> 
> Though it still doesn't work for NSPredicate APIs:, all these years later, ex:
> 
> ---
> #import 
> 
> int main (void)
> {
>  NSPredicate* predicate = [NSPredicate predicateWithFormat:@"foo == %d"];
> 
>  return !!predicate;
> }
> ---
> 
> "clang -Weverything -fsyntax-only ~/test.m" gives nothing!
> 
>   Dupes welcome. :)

The problem is that +predicateWithFormat: accepts conversions that are not part 
of NSString's format string syntax. Adding format string warnings for new 
format string syntaxes requires compiler changes.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Sean McBride
On Thu, 6 Mar 2014 15:15:49 -0800, Jens Alfke said:

>I remember the “Month Of Apple Bugs”** that a hacker group ran in 2007,
>where they published a new app or OS security vulnerability every day
>for month. A lot of them were caused by format-string vulnerabilities.
>Soon thereafter the compiler team at Apple added that format-string
>security warning :)

Though it still doesn't work for NSPredicate APIs:, all these years later, ex:

---
#import 

int main (void)
{
  NSPredicate* predicate = [NSPredicate predicateWithFormat:@"foo == %d"];

  return !!predicate;
}
---

"clang -Weverything -fsyntax-only ~/test.m" gives nothing!

  Dupes welcome. :)

Cheers,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: information about provisioning and code signing - in code

2014-03-06 Thread Torsten Curdt
To answer my own question with some code:

  https://github.com/tcurdt/TCMobileProvision

Let's you access the embedded provisioning profile at runtime.

cheers,
Torsten

On Thu, Feb 27, 2014 at 12:46 PM, Torsten Curdt  wrote:
> Hey there,
>
> I know on 10.6+ you can use "SecStaticCodeCreateWithPath" and friends
> to verify the app signature in code.
>
> Is there also a way on iOS to somehow access information about things
> like provisioning profile/certificate from within the app?
>
> Ideally I would like to get access to the provisioning profile's uuid
> from within the app.
>
> Any pointers?
>
> cheers,
> Torsten
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Jens Alfke

On Mar 6, 2014, at 10:21 AM, William Squires wrote:
> Also, when I do this (using a literal NSString constant for myClassName 
> above), Xcode marks the line with NSLog with a yellow triangle, and 
> disclosing it says something about passing an NSString instance as being 
> "unsecure". Can this warning be turned off? It seems silly to do:
> NSLog(@"%@", fooText);
> just to avoid this warning.

No, this is a very important warning. The format string in a printf-type call 
should _always_ be a constant. Otherwise the code can be vulnerable to a format 
string attack*. In your specific case, the string you pass as the format isn’t 
going to be unsafe, but the compiler doesn’t know that. The really bad 
scenarios happen when the value of the format string can be controlled by user 
or network input; then an attacker can craft special strings containing % 
characters that can crash the app or possibly even make it run malicious code.

I remember the “Month Of Apple Bugs”** that a hacker group ran in 2007, where 
they published a new app or OS security vulnerability every day for month. A 
lot of them were caused by format-string vulnerabilities. Soon thereafter the 
compiler team at Apple added that format-string security warning :)

—Jens

* http://en.wikipedia.org/wiki/Format_string_attack
** http://projects.info-pull.com/moab/
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSSavePanel?

2014-03-06 Thread SevenBits

On Mar 6, 2014, at 4:18 PM, Todd Heberlein  wrote:

> Not sure if this is directly related, but…
> 
> When a non-sandboxed application presents the Open or Save panel, the program 
> starts opening files in the currently selected directory. Move to a different 
> directory, and the application will start pounding on the files in that 
> directory. This seems to be the case with most (all?) non-sandboxed apps, so 
> it is probably part of the Apple library code. This is a pain in the butt for 
> me when I do audit trail analysis.
> 
> Sandboxed applications don’t do this. An Apple daemon does this on the 
> application’s behalf (presumably the “power box”), but from a security point 
> of view, this is much easier to analyze. I encourage developers and users to 
> move to sandboxed apps ASAP. :)

Well, we all would, if it wasn’t such an occasional pain in the ass.

> 
> For a detailed video on this problem, see
> 
> Data Fence: Audit Data vs. Last Access Time
> http://www.toddheberlein.com/videos/2014/1/27/data-fence-audit-data-vs-last-access-time
> 
> Todd
> 
> 
> On Mar 6, 2014, at 11:20 AM, livinginlosange...@mac.com wrote:
> 
>> What’s Adobe’s beef with NSSavePanel? I found this while running fs_usage on 
>> my computer.
>> 
>> Adobe Easter Egg?
>> 
>> 11:14:46  getattrlist   /Volumes/DriveA/030514   0.14   Adobe 
>> Photos
>> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.10   Adobe 
>> Photos
>> 11:14:46  lstat64   __NSSAVEPANEL_IS_SO_L.AME0.07   Adobe 
>> Photos
>> 11:14:46  lstat64   es/DriveA/030514/TestSave0.11   Adobe 
>> Photos
>> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.07   Adobe 
>> Photos
>> 11:14:46  lstat64   __NSSAVEPANEL_IS_SO_L.AME0.06   Adobe 
>> Photos
>> 11:14:46  getattrlist   __NSSAVEPANEL_IS_SO_L.AME0.04   Adobe 
>> Photos
>> 11:14:46  write  0.24   
>> screensharin
>> 11:14:46  select 0.250128 W 
>> netsession_m
>> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.15   Adobe 
>> Photos
>> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.06   Adobe 
>> Photos
>> 11:14:46  getattrlist   /Volumes/DriveA/030514   0.07   Adobe 
>> Photos
>> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.06   Adobe 
>> Photos
>> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.05   Adobe 
>> Photos
>> 11:14:46  write  0.17   
>> screensharin
>> 11:14:46  getattrlist   TESTSAVE_2.psd   0.13   Adobe 
>> Photos
>> ___
>> 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/todd_heberlein%40mac.com
>> 
>> This email sent to todd_heberl...@mac.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:
> https://lists.apple.com/mailman/options/cocoa-dev/sevenbitstech%40gmail.com
> 
> This email sent to sevenbitst...@gmail.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: push button bounds are bigger than I'd expected...

2014-03-06 Thread Lee Ann Rucker

On Mar 6, 2014, at 2:37 PM, Sean McBride wrote:

> Hi all,
> 
> In Interface Builder, if I turn on Editor > Canvas > Show Bounds Rectangles 
> then it shows blue rectangles representing views' bounds rectangles (I 
> suppose).  I notice for push buttons that this blue rectangle is not where I 
> expect it, it's not tight around the visual appearance of the push button, 
> but outset by several pixels.  Is that normal?  Why is this so?

It's space for the focus ring. That's why Autolayout talks about alignment 
rectangles instead of frames: 

https://developer.apple.com/library/ios/documentation/userexperience/conceptual/AutolayoutPG/ImplementingView/ImplementingView.html#//apple_ref/doc/uid/TP40010853-CH16-SW4


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

push button bounds are bigger than I'd expected...

2014-03-06 Thread Sean McBride
Hi all,

In Interface Builder, if I turn on Editor > Canvas > Show Bounds Rectangles 
then it shows blue rectangles representing views' bounds rectangles (I 
suppose).  I notice for push buttons that this blue rectangle is not where I 
expect it, it's not tight around the visual appearance of the push button, but 
outset by several pixels.  Is that normal?  Why is this so?

(I got to this question investigating a weird bug where a custom NSView of mine 
was getting into mouseDragged: and mouseUp: *without* first getting into 
mouseDown:, something I thought should never happen, but I've seen in this 
list's archives that other have seen this in some weirdo situations.  In my 
case, I can reproduce it if my custom NSView has subviews that have push 
buttons and the user clicks just outside the visual edge of the push button but 
within the blue rectangle area that IB draws.)

Thanks,

-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSSavePanel?

2014-03-06 Thread Todd Heberlein
Not sure if this is directly related, but…

When a non-sandboxed application presents the Open or Save panel, the program 
starts opening files in the currently selected directory. Move to a different 
directory, and the application will start pounding on the files in that 
directory. This seems to be the case with most (all?) non-sandboxed apps, so it 
is probably part of the Apple library code. This is a pain in the butt for me 
when I do audit trail analysis.

Sandboxed applications don’t do this. An Apple daemon does this on the 
application’s behalf (presumably the “power box”), but from a security point of 
view, this is much easier to analyze. I encourage developers and users to move 
to sandboxed apps ASAP. :)

For a detailed video on this problem, see

Data Fence: Audit Data vs. Last Access Time
http://www.toddheberlein.com/videos/2014/1/27/data-fence-audit-data-vs-last-access-time

Todd


On Mar 6, 2014, at 11:20 AM, livinginlosange...@mac.com wrote:

> What’s Adobe’s beef with NSSavePanel? I found this while running fs_usage on 
> my computer.
> 
> Adobe Easter Egg?
> 
> 11:14:46  getattrlist   /Volumes/DriveA/030514   0.14   Adobe 
> Photos
> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.10   Adobe 
> Photos
> 11:14:46  lstat64   __NSSAVEPANEL_IS_SO_L.AME0.07   Adobe 
> Photos
> 11:14:46  lstat64   es/DriveA/030514/TestSave0.11   Adobe 
> Photos
> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.07   Adobe 
> Photos
> 11:14:46  lstat64   __NSSAVEPANEL_IS_SO_L.AME0.06   Adobe 
> Photos
> 11:14:46  getattrlist   __NSSAVEPANEL_IS_SO_L.AME0.04   Adobe 
> Photos
> 11:14:46  write  0.24   
> screensharin
> 11:14:46  select 0.250128 W 
> netsession_m
> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.15   Adobe 
> Photos
> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.06   Adobe 
> Photos
> 11:14:46  getattrlist   /Volumes/DriveA/030514   0.07   Adobe 
> Photos
> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.06   Adobe 
> Photos
> 11:14:46  getattrlist   es/DriveA/030514/TestSave0.05   Adobe 
> Photos
> 11:14:46  write  0.17   
> screensharin
> 11:14:46  getattrlist   TESTSAVE_2.psd   0.13   Adobe 
> Photos
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/todd_heberlein%40mac.com
> 
> This email sent to todd_heberl...@mac.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Greg Parker
On Mar 6, 2014, at 10:21 AM, William Squires  wrote:
>  Also, when I do this (using a literal NSString constant for myClassName 
> above), Xcode marks the line with NSLog with a yellow triangle, and 
> disclosing it says something about passing an NSString instance as being 
> "unsecure". Can this warning be turned off? It seems silly to do:
> 
> NSLog(@"%@", fooText);
> 
> just to avoid this warning.

Some class names have '%' in them. If you called NSLog() without using the 
"silly" format string, you'd print nonsense or just crash.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Lee Ann Rucker

On Mar 6, 2014, at 10:21 AM, William Squires wrote:
> 
> 
> 
>  Also, when I do this (using a literal NSString constant for myClassName 
> above), Xcode marks the line with NSLog with a yellow triangle, and 
> disclosing it says something about passing an NSString instance as being 
> "unsecure". Can this warning be turned off? It seems silly to do:
> 
> NSLog(@"%@", fooText);
> 
> just to avoid this warning.
>   

You won't think it's silly when fooText contains something you don't expect.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Cocoa custom text field backspace handling

2014-03-06 Thread Quincey Morris
On Mar 6, 2014, at 11:46 , Kyle Sluder  wrote:

> Hold up.

Aside from the objections you and Mike raised, there’s actually quite a lot 
more to be alarmed about in the OP’s code:

1. It overrides keyUp instead of keyDown. ‘interpretKeyEvents:’ probably isn’t 
even legal in keyUp (which may be why it’s beeping).

2. It (apparently) fails to account for the fact that ‘interpretKeyEvents:’ 
will eventually invoke ‘insertText:’ if the keystroke isn’t an editing 
function, so an unconditional ‘appendString:’ is likely duplicative.

3. It’s not even remotely clear whether the OP is trying to suppress the 
delete, re-implement the standard delete behavior, or some odd combination of 
both.

___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Cocoa custom text field backspace handling

2014-03-06 Thread SevenBits
On Mar 6, 2014, at 2:46 PM, Kyle Sluder  wrote:

> On Thu, Mar 6, 2014, at 10:30 AM, Daniel Luis dos Santos wrote:
>> I am developing a custom textfield in Cocoa. To handle the backspace
>> character I should be defining :
> 
> Hold up. It's fairly very rare to subclass NSTextView and do custom
> processing there. Why do you feel the need to do this?
> 
> Cocoa already has a delegation mechanism for customizing the behavior of
> certain keys. Look up -doCommandBySelector: and
> -control:textView:doCommandBySelector:.

I concur. Cocoa is very much against re-inventing the wheel. Why can’t you use 
the system-provided class and everything that comes with it?

> 
> --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:
> https://lists.apple.com/mailman/options/cocoa-dev/sevenbitstech%40gmail.com
> 
> This email sent to sevenbitst...@gmail.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Cocoa custom text field backspace handling

2014-03-06 Thread Kyle Sluder
On Thu, Mar 6, 2014, at 10:30 AM, Daniel Luis dos Santos wrote:
> I am developing a custom textfield in Cocoa. To handle the backspace
> character I should be defining :

Hold up. It's fairly very rare to subclass NSTextView and do custom
processing there. Why do you feel the need to do this?

Cocoa already has a delegation mechanism for customizing the behavior of
certain keys. Look up -doCommandBySelector: and
-control:textView:doCommandBySelector:.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Cocoa custom text field backspace handling

2014-03-06 Thread Mike Abdullah

On 6 Mar 2014, at 18:30, Daniel Luis dos Santos  wrote:

> I am developing a custom textfield in Cocoa. To handle the backspace 
> character I should be defining :

When you say custom, do you mean you’re trying to customise NSTextField? Or 
that you’re actually trying to write a completely custom text field that isn’t 
descended from the existing one?

If the former, rather than subclassing, I suggest the available delegate 
methods will help with what you want a lot better.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: NSSavePanel?

2014-03-06 Thread Kyle Sluder
On Thu, Mar 6, 2014, at 11:20 AM, livinginlosange...@mac.com wrote:
> What’s Adobe’s beef with NSSavePanel? I found this while running fs_usage
> on my computer.
> 
> Adobe Easter Egg?

No clue, but this thread isn't going to provide any useful discussion.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

NSSavePanel?

2014-03-06 Thread livinginlosangeles
What’s Adobe’s beef with NSSavePanel? I found this while running fs_usage on my 
computer.

Adobe Easter Egg?

11:14:46  getattrlist   /Volumes/DriveA/030514   0.14   Adobe Photos
11:14:46  getattrlist   es/DriveA/030514/TestSave0.10   Adobe Photos
11:14:46  lstat64   __NSSAVEPANEL_IS_SO_L.AME0.07   Adobe Photos
11:14:46  lstat64   es/DriveA/030514/TestSave0.11   Adobe Photos
11:14:46  getattrlist   es/DriveA/030514/TestSave0.07   Adobe Photos
11:14:46  lstat64   __NSSAVEPANEL_IS_SO_L.AME0.06   Adobe Photos
11:14:46  getattrlist   __NSSAVEPANEL_IS_SO_L.AME0.04   Adobe Photos
11:14:46  write  0.24   screensharin
11:14:46  select 0.250128 W netsession_m
11:14:46  getattrlist   es/DriveA/030514/TestSave0.15   Adobe Photos
11:14:46  getattrlist   es/DriveA/030514/TestSave0.06   Adobe Photos
11:14:46  getattrlist   /Volumes/DriveA/030514   0.07   Adobe Photos
11:14:46  getattrlist   es/DriveA/030514/TestSave0.06   Adobe Photos
11:14:46  getattrlist   es/DriveA/030514/TestSave0.05   Adobe Photos
11:14:46  write  0.17   screensharin
11:14:46  getattrlist   TESTSAVE_2.psd   0.13   Adobe Photos
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Scott Andrew
Even further you can get the current command by using 
NSStringFromSelector(_cmd); _cmd is the current selector.

You can also use NSLog(@“%s”, _PRETTY_FUNCTION”) which will give you the class 
name and current selector. 

Do a google search also for NSLog replacements there are ones that do a lot of 
work of prepending all NSlog calls with class, function, line number and you 
custom message. Like the answer here:
http://stackoverflow.com/questions/969130/how-to-print-out-the-method-name-and-line-number-and-conditionally-disable-nslog

Scott

On Mar 6, 2014, at 10:21 AM, William Squires  wrote:

>  Given an object, and a method within, is there some way to get the name of 
> the class of the object as an NSString?
>  For that matter, what I want to do is something like this:
> 
> Class MyClass
> "MyClass.h"
> #import 
> 
> @interface MyClass : NSObject
> 
> ...
> 
> -(void)myMethod;
> 
> @end
> 
> "MyClass.m"
> #import "MyClass.h"
> 
> @implementation MyClass
> 
> ...
> -(void)myMethod
> {
> NSString *myClassName = ???; // What can I put here besides a literal 
> @"MyClass"?
> 
> NSString *fooText = [NSString stringWithFormat:@"<%@> -(void)myMethod", 
> myClassName];
> NSLog(fooText); // Yellow triangle on this line
> }
> ...
> @end
> 
> so that when the myMethod message is sent to an object of MyClass, the output 
> should be:
> 
> <>:  -(void)myMethod
> 
> on the output pane when debugging - "<>" just comes from the NSLog 
> call.
> 
>  Also, when I do this (using a literal NSString constant for myClassName 
> above), Xcode marks the line with NSLog with a yellow triangle, and 
> disclosing it says something about passing an NSString instance as being 
> "unsecure". Can this warning be turned off? It seems silly to do:
> 
> NSLog(@"%@", fooText);
> 
> just to avoid this warning.
>  By using this strategy, if several classes implement the same message, I can 
> tell which instance received the message during debugging; this is handy when 
> iterating over containers (such as NSArray), and passing the same message to 
> multiple objects, or when passing messages to objects of subclasses that 
> override the behavior of their super.
>  TIA!
> 
> 
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40roadrunner.com
> 
> This email sent to scottand...@roadrunner.com



smime.p7s
Description: S/MIME cryptographic signature
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Ken Thomases
On Mar 6, 2014, at 12:21 PM, William Squires wrote:

>  Given an object, and a method within, is there some way to get the name of 
> the class of the object as an NSString?

Well, you could do NSStringFromClass([self class]) but that gives the name of 
the object's dynamic class, which is not necessarily the same as the class in 
which the method is implemented.

>  For that matter, what I want to do is something like this:

> -(void)myMethod
> {
> NSString *myClassName = ???; // What can I put here besides a literal 
> @"MyClass"?
> 
> NSString *fooText = [NSString stringWithFormat:@"<%@> -(void)myMethod", 
> myClassName];
> NSLog(fooText); // Yellow triangle on this line
> }

Are you aware of the __func__ (or __PRETTY_FUNCTION__) compiler-defined 
variable?  It is a C string whose content is "-[MyClass myMethod]".  (In a 
function, it will be the function name rather than the method name.)

So, you could do:

NSLog(@"%s", __func__);


>  Also, when I do this (using a literal NSString constant for myClassName 
> above), Xcode marks the line with NSLog with a yellow triangle, and 
> disclosing it says something about passing an NSString instance as being 
> "unsecure". Can this warning be turned off? It seems silly to do:
> 
> NSLog(@"%@", fooText);
> 
> just to avoid this warning.

It almost certainly can be turned off.  Usually, the warning line from the 
compiler explains which warning option enabled the particular warning and you 
can turn it off by insert "no" in a compiler option.  However: 1) it's a 
valuable warning, and 2) you're already using a format string to construct 
fooText.  Why not just put that format string into the NSLog() call and 
eliminate the fooText temporary variable?

Regards,
Ken


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Kyle Sluder
> On Mar 6, 2014, at 10:21 AM, William Squires  wrote:
> 
>  Given an object, and a method within, is there some way to get the name of 
> the class of the object as an NSString?
>  For that matter, what I want to do is something like this:
> 
> Class MyClass
> "MyClass.h"
> #import 
> 
> @interface MyClass : NSObject
> 
> ...
> 
> -(void)myMethod;
> 
> @end
> 
> "MyClass.m"
> #import "MyClass.h"
> 
> @implementation MyClass
> 
> ...
> -(void)myMethod
> {
> NSString *myClassName = ???; // What can I put here besides a literal 
> @"MyClass"?

NSStringFromClass([self class])


> 
> NSString *fooText = [NSString stringWithFormat:@"<%@> -(void)myMethod", 
> myClassName];
> NSLog(fooText); // Yellow triangle on this line

You should learn about __PRETTY_FUNCTION__, which is a preprocessor macro that 
expands to a C string literal containing the name of the current 
function/method (including class).

--Kyle Sluder

> }
> ...
> @end
> 
> so that when the myMethod message is sent to an object of MyClass, the output 
> should be:
> 
> <>:  -(void)myMethod
> 
> on the output pane when debugging - "<>" just comes from the NSLog 
> call.
> 
>  Also, when I do this (using a literal NSString constant for myClassName 
> above), Xcode marks the line with NSLog with a yellow triangle, and 
> disclosing it says something about passing an NSString instance as being 
> "unsecure". Can this warning be turned off? It seems silly to do:
> 
> NSLog(@"%@", fooText);
> 
> just to avoid this warning.

Yes, passing dynamic strings as the first argument to NSLog, etc. has been the 
cause of many buffer overruns (and security vulnerabilities) in the past. Apple 
fixed a whole bunch of them a few OS revs back.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Cocoa custom text field backspace handling

2014-03-06 Thread Daniel Luis dos Santos
I am developing a custom textfield in Cocoa. To handle the backspace character 
I should be defining :

- (void) keyUp: (NSEvent*)theEvent {
[self interpretKeyEvents: [NSArray arrayWithObject: theEvent];

NSString *text = [theEvent charactersIgnoringModifiers];
[[self text] appendString: text];
}
Then implement :

- (void) deleteBackward:(id)sender {
if ([[self text] length] == 0)
return;
NSString* textMinusLastCharacter = [[self text] substringToIndex: [[self 
text] length] - 1];
[self setText: [NSMutableString stringWithString: textMinusLastCharacter]];
[self setNeedsDisplay:YES];
}
When I run the application, for every alphanumeric character key I press I hear 
a sound. When I press the backspace key, a call is made to the deleteBackward: 
and after that the key up method appends the backspace char to the end of the 
string. How do I filter the backspace key press in a device independent manner 
(without key codes).

Seems like the event is being passed to someplace else up in the responder 
chain. How do I control that? I am avoiding comparing keyCodes that come 
through the event object. I want to remove the sound played when each character 
is pressed.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Class name as NSString and problem with NSLog?

2014-03-06 Thread Sixten Otto
First off, you don't need to build the string ahead of time; NSLog()
supports vararg formatting:
NSLog(@"<%@> -(void)myMethod", myClassName);

Off the top of my head, I can't recall whether Class objects get formatted
as the class name automatically:
NSLog(@"<%@> -(void)myMethod", [self class]);  // works??

But you can certainly convert to a string with the name of the class
explicitly with NSStringFromClass():
NSLog(@"<%@> -(void)myMethod", NSStringFromClass([self class));


On Thu, Mar 6, 2014 at 11:21 AM, William Squires wrote:

>   Given an object, and a method within, is there some way to get the name
> of the class of the object as an NSString?
>   For that matter, what I want to do is something like this:
>
> Class MyClass
> "MyClass.h"
> #import 
>
> @interface MyClass : NSObject
>
> ...
>
> -(void)myMethod;
>
> @end
>
> "MyClass.m"
> #import "MyClass.h"
>
> @implementation MyClass
>
> ...
> -(void)myMethod
> {
> NSString *myClassName = ???; // What can I put here besides a literal
> @"MyClass"?
>
> NSString *fooText = [NSString stringWithFormat:@"<%@> -(void)myMethod",
> myClassName];
> NSLog(fooText); // Yellow triangle on this line
> }
> ...
> @end
>
> so that when the myMethod message is sent to an object of MyClass, the
> output should be:
>
> <>:  -(void)myMethod
>
> on the output pane when debugging - "<>" just comes from the
> NSLog call.
>
>   Also, when I do this (using a literal NSString constant for myClassName
> above), Xcode marks the line with NSLog with a yellow triangle, and
> disclosing it says something about passing an NSString instance as being
> "unsecure". Can this warning be turned off? It seems silly to do:
>
> NSLog(@"%@", fooText);
>
> just to avoid this warning.
>   By using this strategy, if several classes implement the same message, I
> can tell which instance received the message during debugging; this is
> handy when iterating over containers (such as NSArray), and passing the
> same message to multiple objects, or when passing messages to objects of
> subclasses that override the behavior of their super.
>   TIA!
>
>
>
> ___
>
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/himself%40sfko.com
>
> This email sent to hims...@sfko.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Class name as NSString and problem with NSLog?

2014-03-06 Thread William Squires
  Given an object, and a method within, is there some way to get the name of 
the class of the object as an NSString?
  For that matter, what I want to do is something like this:

Class MyClass
"MyClass.h"
#import 

@interface MyClass : NSObject

...

-(void)myMethod;

@end

"MyClass.m"
#import "MyClass.h"

@implementation MyClass

...
-(void)myMethod
{
NSString *myClassName = ???; // What can I put here besides a literal 
@"MyClass"?

NSString *fooText = [NSString stringWithFormat:@"<%@> -(void)myMethod", 
myClassName];
NSLog(fooText); // Yellow triangle on this line
}
...
@end

so that when the myMethod message is sent to an object of MyClass, the output 
should be:

<>:  -(void)myMethod

on the output pane when debugging - "<>" just comes from the NSLog 
call.

  Also, when I do this (using a literal NSString constant for myClassName 
above), Xcode marks the line with NSLog with a yellow triangle, and disclosing 
it says something about passing an NSString instance as being "unsecure". Can 
this warning be turned off? It seems silly to do:

NSLog(@"%@", fooText);

just to avoid this warning.
  By using this strategy, if several classes implement the same message, I can 
tell which instance received the message during debugging; this is handy when 
iterating over containers (such as NSArray), and passing the same message to 
multiple objects, or when passing messages to objects of subclasses that 
override the behavior of their super.
  TIA!



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Draw image within a NSBezierPath with no border

2014-03-06 Thread Kyle Sluder

> On Mar 6, 2014, at 9:25 AM, Leonardo  wrote:
> 
> That's make sense. Do you know any workaround?
> I have to draw the background color because:
>1) the user could choose to see a background color on the area not
> covered by the image. Let's imagine a circle divided in 3 slices by two
> vertical lines. In the middle we have the image, and on the left and right
> areas we see the color. So, at the top and bottom of the image I see that
> bad blue curved border.

Create a CGLayer from your destination context that is the size of your image. 
Fill it with your background color. Draw your image into it. Set the clipping 
path on the destination context. Draw the CGLayer into the destination context.

>2) In case of shadow, if I do not fill with a color before clipping the
> path I can't get the shadow out of the path. If I do
> 
> CGContextSetShadowWithColor...
> [fillPath addClip];
> [image drawInRect:fillBounds fromRect:NSZeroRect
> operation:NSCompositeSourceOver fraction:1.0];
> 
> I can't get the shadow out of the fillPath.

I don’t know what you mean by “get the shadow out of the fillPath”.

Do you mean that you don’t want the shadow to appear below transparent parts 
the your image?

> Instead If I do:
> 
> CGContextSetShadowWithColor...
>[aBlueColor set];
>[fillPath fill];
> RemoveShadow
>[fillPath addClip];
>[image drawInRect:fillBounds fromRect:NSZeroRect
>operation:NSCompositeSourceOver fraction:1.0];
> 
> The problem is that I must clip the path before drawing the image, and as
> result the image itself can't project shadow outside the clipped path.
> I am puzzled.

If you use my above technique, you should be able to create the shadow and then 
draw the layer on top of it:

- drawRect: {
  // Draw the shadow
  CGContextSaveGState();
  NSBezierPath *oval = …;
  [[NSColor clearColor] setFill];
  CGContextSetShadowWithColor(…);
  [oval fill];
  CGContextRestoreGState();

  // Draw the clipped image
  CGLayerRef layer = MakeLayerFromImage();
  CGContextSaveGState();
  [oval addClip];
  CGLayerDrawAtPoint(layer, …);
  CGContextRestoreGState();
}

This might not work. I’m unsure of the behavior of Quartz shadows when drawing 
with +clearColor. If it doesn’t work, you might want to look into Quartz 
transparency layers (which are not the same thing as CGLayerRefs).

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Draw image within a NSBezierPath with no border

2014-03-06 Thread Leonardo
That's make sense. Do you know any workaround?
I have to draw the background color because:
1) the user could choose to see a background color on the area not
covered by the image. Let's imagine a circle divided in 3 slices by two
vertical lines. In the middle we have the image, and on the left and right
areas we see the color. So, at the top and bottom of the image I see that
bad blue curved border.
2) In case of shadow, if I do not fill with a color before clipping the
path I can't get the shadow out of the path. If I do

CGContextSetShadowWithColor...
[fillPath addClip];
[image drawInRect:fillBounds fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:1.0];

I can't get the shadow out of the fillPath.
Instead If I do:

CGContextSetShadowWithColor...
[aBlueColor set];
[fillPath fill];
RemoveShadow
[fillPath addClip];
[image drawInRect:fillBounds fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:1.0];

The problem is that I must clip the path before drawing the image, and as
result the image itself can't project shadow outside the clipped path.
I am puzzled.


Regards
-- Leonardo


> Da: Kyle Sluder 
> Data: Thu, 6 Mar 2014 09:02:00 -0800
> A: Leonardo 
> Cc: "cocoa-dev@lists.apple.com" 
> Oggetto: Re: Draw image within a NSBezierPath with no border
> 
> On Mar 6, 2014, at 8:34 AM, Leonardo  wrote:
>> 
>> Hi, I have an oval NSBezierPath path. I fill it with a blue color,
>> then I draw an image within the same path. And I can still see a blue tiny
>> border around the image. I would expect the color be never visible since the
>> image covers the whole area. That's my code:
>> 
>> fillPath = [NSBezierPath bezierPathWithOvalInRect:fillBounds];
>> [aBlueColor set];
>> [fillPath fill];
>> [fillPath addClip];
>> [image drawInRect:fillBounds fromRect:NSZeroRect
>> operation:NSCompositeSourceOver fraction:1.0];
>> 
>> Even if I draw the image in a bigger rect, the blue border is still there.
>> What do I miss?
> 
> Due to antialiasing, the fringes of your mask have alpha < 1.
> 
> Let¹s say there¹s a pixel on the fringe of your mask that winds up with alpha
> 0.5. Using your code, that pixel's final color will be 0.5 * (0.5 * Original
> background color + 0.5 * blue) + 0.5 * (color from image).
> 
> --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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Draw image within a NSBezierPath with no border

2014-03-06 Thread Kyle Sluder
On Mar 6, 2014, at 8:34 AM, Leonardo  wrote:
> 
> Hi, I have an oval NSBezierPath path. I fill it with a blue color,
> then I draw an image within the same path. And I can still see a blue tiny
> border around the image. I would expect the color be never visible since the
> image covers the whole area. That's my code:
> 
> fillPath = [NSBezierPath bezierPathWithOvalInRect:fillBounds];
> [aBlueColor set];
> [fillPath fill];
> [fillPath addClip];
> [image drawInRect:fillBounds fromRect:NSZeroRect
> operation:NSCompositeSourceOver fraction:1.0];
> 
> Even if I draw the image in a bigger rect, the blue border is still there.
> What do I miss?

Due to antialiasing, the fringes of your mask have alpha < 1.

Let’s say there’s a pixel on the fringe of your mask that winds up with alpha 
0.5. Using your code, that pixel's final color will be 0.5 * (0.5 * Original 
background color + 0.5 * blue) + 0.5 * (color from image).

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Draw image within a NSBezierPath with no border

2014-03-06 Thread Kevin Meaney
I'd try clipping before drawing the fill, rather than after.

Kevin

On 6 Mar 2014, at 16:34, Leonardo  wrote:

> Hi, I have an oval NSBezierPath path. I fill it with a blue color,
> then I draw an image within the same path. And I can still see a blue tiny
> border around the image. I would expect the color be never visible since the
> image covers the whole area. That's my code:
> 
> fillPath = [NSBezierPath bezierPathWithOvalInRect:fillBounds];
> [aBlueColor set];
> [fillPath fill];
> [fillPath addClip];
> [image drawInRect:fillBounds fromRect:NSZeroRect
> operation:NSCompositeSourceOver fraction:1.0];
> 
> Even if I draw the image in a bigger rect, the blue border is still there.
> What do I miss?
> 
> 
> Regards
> -- Leonardo
> 
> 
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/ktam%40yvs.eu.com
> 
> This email sent to k...@yvs.eu.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Draw image within a NSBezierPath with no border

2014-03-06 Thread Leonardo
Hi, I have an oval NSBezierPath path. I fill it with a blue color,
then I draw an image within the same path. And I can still see a blue tiny
border around the image. I would expect the color be never visible since the
image covers the whole area. That's my code:

fillPath = [NSBezierPath bezierPathWithOvalInRect:fillBounds];
[aBlueColor set];
[fillPath fill];
[fillPath addClip];
[image drawInRect:fillBounds fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:1.0];

Even if I draw the image in a bigger rect, the blue border is still there.
What do I miss?


Regards
-- Leonardo


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Inherited Protocols

2014-03-06 Thread Mike Abdullah

On 6 Mar 2014, at 16:29, jonat...@mugginsoft.com wrote:

> 
> On 6 Mar 2014, at 15:34, Mike Abdullah  wrote:
> 
>> 
>> On 6 Mar 2014, at 15:30, William Squires  wrote:
>> 
>>> Can an ObjC protocol be inherited by another protocol? I know the syntax 
>>> for regular (class) inheritance, and for specifying that a class implements 
>>> a protocol, but what's the syntax (if there is one) for one protocol 
>>> inheriting from another?
>> 
>> Much the same as declaring the same for a class. e.g. this is quite common:
>> 
>> @protocol MyProtocol 
>> …
>> @end
>> 
> I was wondering recently if it is possible to derive a protocol from an 
> interface declaration?

It is not possible, sorry.
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Inherited Protocols

2014-03-06 Thread jonat...@mugginsoft.com

On 6 Mar 2014, at 15:34, Mike Abdullah  wrote:

> 
> On 6 Mar 2014, at 15:30, William Squires  wrote:
> 
>> Can an ObjC protocol be inherited by another protocol? I know the syntax for 
>> regular (class) inheritance, and for specifying that a class implements a 
>> protocol, but what's the syntax (if there is one) for one protocol 
>> inheriting from another?
> 
> Much the same as declaring the same for a class. e.g. this is quite common:
> 
> @protocol MyProtocol 
> …
> @end
> 
I was wondering recently if it is possible to derive a protocol from an 
interface declaration?

I have been using NSObject -forwardingTargetForSelector to implement Obj-C 
style multiple inheiritance.
In this case it is useful to have a protocol for the forwarding target that the 
base class can inherit.
In most cases though only an interface will be available.

May be that my approach is wanting here.

Jonathan 














___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Inherited Protocols

2014-03-06 Thread Uli Kusterer
On 06 Mar 2014, at 16:34, Mike Abdullah  wrote:
> This means any object adopting MyProtocol must implement all of the NSObject 
> protocol’s methods too.


 Useful thing to point out here: There are both a class and a protocol named 
'NSObject'. In fact, the class conforms to the protocol.

-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."



___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Inherited Protocols

2014-03-06 Thread Mike Abdullah

On 6 Mar 2014, at 15:30, William Squires  wrote:

> Can an ObjC protocol be inherited by another protocol? I know the syntax for 
> regular (class) inheritance, and for specifying that a class implements a 
> protocol, but what's the syntax (if there is one) for one protocol inheriting 
> from another?

Much the same as declaring the same for a class. e.g. this is quite common:

@protocol MyProtocol 
…
@end

This means any object adopting MyProtocol must implement all of the NSObject 
protocol’s methods too.
___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Inherited Protocols

2014-03-06 Thread William Squires
Can an ObjC protocol be inherited by another protocol? I know the syntax for 
regular (class) inheritance, and for specifying that a class implements a 
protocol, but what's the syntax (if there is one) for one protocol inheriting 
from another?

i.e.

I have a protocol, INotSoStiffProtocol that has one method declaration:

-(void)YouMustImplementMe;

If I now have another protocol, IStifferProtocol that inherits from 
INotSoStillProtocol, it should require that any class implementing it also 
implement:

-(void)YouMustImplementMeToo:(NSString *)aGoofyMessage;

I can certainly just create a "IStifferProtocol.h" file and hand-code it (of 
course), but I'm wondering if there's an easier way.


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: secure uitextfield is not secure

2014-03-06 Thread William Squires
  I believe it's because of the virtual on-screen keyboard - this way you can 
verify whether the character you typed has uppercase or not, since the virtual 
keyboard has no "Caps Lock" LED on it, or just because the iPhone screen 
keyboard keys are so small, it's easy to make a typo when entering your 
password.
  I do wish they (Apple) would make it so that if you're using a wireless 
(bluetooth) keyboard, that it would - in fact - hide the on-screen character(s) 
in a secure TextField. But this behavior has been around since at least when 
they called it iPhone OS, I believe... I could be wrong.
  HTH!

On Mar 5, 2014, at 1:17 PM, Luther Baker  wrote:

> I'm generally a big fan of Cocoa Touch - but why does the "secure" option
> on a UITextField still display the character you are typing?
> 
> And, is there any way I can turn this off?
> 
> Its generally hard to get non-employee AD credentials created or to stand
> up DEV Active Directory services ... so everywhere I've ever worked, folks
> like me are always entering their real AD creds in the app during
> development. This is embarrassing when you are pairing and even worse, was
> in a demo today and the leader is asking everyone "not to look" while they
> entered their AD credentials in front of a whole host of people.
> 
> I guess one could write something to work around this ... but does anyone
> know if that is really necessary - and what would have motivated Apple to
> implement textField.secureTextEntry this way ... or not provide a textField.
> *really*SecureTextEntry option which would mask ALL the characters. Maybe
> an option that doesn't even show how many # the user is actually typing.
> I'm surely not counting 14+ characters anymore.
> 
> -Luther
> ___
> 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/wsquires%40satx.rr.com
> 
> This email sent to wsqui...@satx.rr.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: secure uitextfield is not secure

2014-03-06 Thread Uli Kusterer
On 05 Mar 2014, at 23:57, Quincey Morris  
wrote:
> Incidentally, having a “fully obscured” custom text field won’t help you in 
> the demo scenario, because the audience can still see the key images pop up 
> on the keyboard as you type. Are you proposing removing that feedback too? 
> (And how will you do that?)

 Unless you’re recording, the key caps popping up is less of an issue. They pop 
up in different places, so an audience member’s or shoulder-surfer’s eyes have 
to follow the cap as it’s popping up and read it that moment. At the usual 
typing speed, by the time my eyes have jumped to the key cap, it has closed 
already.

 On the other hand, in the text field it is obvious where the next character 
will pop up, and they show up in the proper reading order, so it is so easy to 
read a password I often do it accidentally.

>> How very sad ... there should really be no way I could influence Apple in
>> this regard. IE: this isn't some elaborate, hard to define bug. This better
>> not be an accident that requires energy from someone as insignificant as me
> 
> I agree with the earlier post which said (more or less) that if it’s your job 
> to demo stuff, then it’s also your (your company’s) responsibility to provide 
> a non-secure demo platform, or a non-secure account.

 Definitely. If data is confidential enough to protect by password access, you 
should be using a demo server with dummy data. That’s better for a demo anyway. 
If you can run that demo server locally, you’re insulated from network issues 
during your demo like other users eating up all the bandwidth or Wifi 
interference.

 If, for some reason that is not an option (why?), having single-use accounts 
or accounts with pseudo-random single-usepasswords is probably the best. That 
way, even if someone sees the password onscreen, it has already changed by the 
time an audience member might enter it.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: secure uitextfield is not secure

2014-03-06 Thread Uli Kusterer
On 05 Mar 2014, at 23:17, Alex Kac  wrote:
> Perhaps a good bug report is that the user’s screen works the same way it 
> does now, but if its mirrored - then the mirrored screen keeps he password 
> hidden. That would be a good use case. 

 That’s a very presenter-specific use case. I have quite a lot of fun at 
conferences/concerts whispering peoples’ passwords back to them from the seat 
behind them as I accidentally shoulder-surf them. For a mobile device, this is 
the wrong solution.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


___

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com