Re: Image preview with UIWebView

2011-01-25 Thread Kyle Sluder
On Tue, Jan 25, 2011 at 10:05 PM, Leon Qiao  wrote:
> I plan to use the UIWebView to display the preview of some image files.
> It works well when opening the common files. But it seems some special
> formats (such as "CRW", Canon Camera Raw file) are not supported. It can be
> viewed via the QLPreviewController. Is there any better way to do the file
> preview function?

Sounds like you're not going to be able to use a UIWebView for your preview.

ImageIO can read Canon RAW images. Create a CGImageSource with the
file's URL and you'll be able to get a CGImage out of it. You can then
wrap it in a UIImageView and display it in a preview UI, or otherwise
use it as you would any other CGImage.

--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: Using NSWindow without NIB (XIB) file ?

2011-01-25 Thread Lou Zell
On Tue, Jan 25, 2011 at 2:48 AM, David Remacle  wrote:

> Hello
>
> Is it possible to use NSWindow without NIB file ?
>
>
Below is a code sample I put together when I was trying to accomplish the
same thing.  I was pretty against Interface Builder when I first started
with Cocoa because it felt a bit too magical.  Since then I have seen the
light, as they say.  Anyway, here it is, name it WindowNoIB.m:

// Compile and run with:
// $ gcc WindowNoIB.m -Wall -lobjc -framework Foundation -framework AppKit
-o WindowNoIB && ./WindowNoIB
#import 
#import 

// MyClass is going to be the NSApplicationDelegate.  See this:
//
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/NSApplicationDelegate_Protocol/Reference/Reference.html
@interface MyClass:NSObject{
}
@property (nonatomic, retain) NSWindow *window;
@end

@implementation MyClass
@synthesize window;
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
  NSLog(@"Finished Launching %@", notification);

  NSWindow *localWindow = [[NSWindow alloc] initWithContentRect:[[NSScreen
mainScreen] frame]

 styleMask:NSResizableWindowMask

 backing:NSBackingStoreBuffered
  defer:NO];
  [self setWindow:localWindow];
  [localWindow release];

  NSView *localView = [[NSView alloc] init];
  [window setContentView:localView];
  [localView release];

  [window setLevel:NSFloatingWindowLevel];
  [window makeKeyAndOrderFront:self];
}
@end

int main (int argc, const char *argv[]) {
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

  // The first time sharedApplication is called, it creates an instance of
NSApplication
  //
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSApplication_Class/Reference/Reference.html
  [NSApplication sharedApplication];

  NSLog(@"%@", NSApp);

  MyClass *myClass = [[MyClass alloc] init];
  [NSApp setDelegate:myClass];
  [NSApp run];

  [myClass release];
  [pool release];

  return (0);
}

Best,
Lou
___

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


Image preview with UIWebView

2011-01-25 Thread Leon Qiao
Dear all,

I plan to use the UIWebView to display the preview of some image files.
It works well when opening the common files. But it seems some special
formats (such as "CRW", Canon Camera Raw file) are not supported. It can be
viewed via the QLPreviewController. Is there any better way to do the file
preview function?

Thanks.

-- 
Best regards
Leon
___

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: Using NSWindow without NIB (XIB) file ?

2011-01-25 Thread mlist0...@gmail.com
This should be a FAQ. The topic of Cocoa without Interface Builder comes up on 
the list surprisingly frequently, usually from someone who, like you, is 
"trying to understand how Cocoa really works". 

You may be thinking that graphical UI builders (like Interface Builder) are 
somehow a crutch and a barrier to understanding. That might be the case for 
other environments, but Interface Builder is a integral part of Cocoa 
Application development, not a shortcut for newbies. Which is to say, if you 
think bypassing Interface Builder is a purer path to app development, you have 
already missed the point.

But to answer your question, yes, it is possible to create an NSWindow (or any 
other UI element) programmatically.

_murat

On Jan 25, 2011, at 2:48 AM, David Remacle wrote:

> Hello
> 
> Is it possible to use NSWindow without NIB file ?
> 
> I can compile terminal application without using Xcode (by using gcc
> -framework Foundation files -o progname) but how do that with a gui
> application with Nib file ? 
> 
> It's just for understand how xcode compile the application with nib file
> and obtain an .app file.
> 
> Is there a note in the documentation that explain ?
___

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: Using NSWindow without NIB (XIB) file ?

2011-01-25 Thread Ken Thomases
On Jan 25, 2011, at 4:48 AM, David Remacle wrote:

> Is it possible to use NSWindow without NIB file ?

It is definitely possible to create NSWindow objects in code, without using a 
NIB.  However, the rest of your email suggests you're trying to build an entire 
application without either NIBs or Xcode's smarts for putting together an 
application bundle.  That is possible, but not well supported and not 
recommended.


> I can compile terminal application without using Xcode (by using gcc
> -framework Foundation files -o progname) but how do that with a gui
> application with Nib file ? 
> 
> It's just for understand how xcode compile the application with nib file
> and obtain an .app file.

An application bundle (.app) is not a file, it's a directory with a specific 
internal structure.  The Finder usually presents it to the user as a single 
item (like a file), but it's a directory.

GCC does not know anything about building application bundles.  If you want to 
create one without using Xcode, you'll have to do it yourself.  It's not 
terribly hard.  You can start with a simple application built by Xcode and 
hollow it out, and then fill in the relevant pieces yourself.  Or you can just 
create everything from scratch.

Even if you build your application bundle manually, it should usually contain 
at least a MainMenu NIB.  It is possible to create an application without one, 
but there's very little reason to do that.  Your MainMenu NIB can be minimal.  
If you really want to go this route, try doing a web search for "nibless".


> Is there a note in the documentation that explain ?

The documentation does not explain the specific steps to use, because it's not 
a supported technique.  It does document the internal directory structure of an 
application bundle, though.
http://developer.apple.com/library/ios/#documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html

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

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


Re: Using NSWindow without NIB (XIB) file ?

2011-01-25 Thread Sherm Pendley
On Tue, Jan 25, 2011 at 5:48 AM, David Remacle  wrote:
>
> Is it possible to use NSWindow without NIB file ?

Yes. Interface Builder uses documented, public methods to create
interface elements before serializing them to a NIB file. You can use
the same methods in your app. Honestly though, I wouldn't; most of the
time, creating and loading a NIB is far, far simpler.

> I can compile terminal application without using Xcode (by using gcc
> -framework Foundation files -o progname) but how do that with a gui
> application with Nib file ?
>
> It's just for understand how xcode compile the application with nib file
> and obtain an .app file.

I assume you're accustomed to Windows, where code and resources are
both compiled into a single .exe file. In both Mac OS X and iOS,
that's not the case. App bundles are actually directories, and .nib
files are simply copied into the Contents/Resources/ subdirectory
within the bundle. For an in-depth look at what goes into .app and
other bundle types, have a look at:

  


If you *really* want to, you can use gcc & a make file to create a
.app bundle. Doing so might be an interesting learning exercise, but
it's not something I'd suggest doing on an everyday basis - it's
really the hard way of doing things.

sherm--

-- 
Cocoa programming in Perl:
http://camelbones.sourceforge.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: WebKit WebArchive Create but no Load?

2011-01-25 Thread Bruce Cresanta
SOLVED--

The webArchive message on the dataSource is faulty-- it creates bad archives.   
 Much better to create a WebArchive with it's own initialization routine that 
takes a mainResource and subresources.   The loadArchive works flawlessly 
against  a webarchive created in this fashion.

Bruce


On Jan 25, 2011, at 3:40 AM, Mike Abdullah wrote:

> -[WebFrame loadArchive:]
> 
> On 25 Jan 2011, at 04:29, Bruce Cresanta wrote:
> 
>> Hello,
>> 
>> It is rather straightforward to create a webarchive in Cocoa:
>> 
>> WebArchive* archive = [[[webArchive mainFrame] dataSource] webArchive]
>> 
>> However... Once you have this archive, there seems to be no way to load it 
>> back into the webview.
>> 
>> Am I missing something??
>> 
>> Any guidance is very much appreciated.
>> 
>> Thank you,
>> 
>> Bruce
>> ___
>> 
>> 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/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.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


Using NSWindow without NIB (XIB) file ?

2011-01-25 Thread David Remacle
Hello

Is it possible to use NSWindow without NIB file ?

I can compile terminal application without using Xcode (by using gcc
-framework Foundation files -o progname) but how do that with a gui
application with Nib file ? 

It's just for understand how xcode compile the application with nib file
and obtain an .app file.

Is there a note in the documentation that explain ?

(sorry for my poor english)

David Remacle

-- 
David Remacle

___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread WT
On Jan 25, 2011, at 8:45 PM, Dave Carrigan wrote:

> I don't have your original message any more, but my understanding is that you 
> have rolled your own tab bar controller.

Yes, though not all of its functionality.

> When the docs say that a UINavigationController can be a tab in a tab bar 
> interface, they mean a UITabBarController, not a UIViewController that 
> happens to implement a tab bar interface.

If that's the case, then I think they should make that distinction explicit in 
the docs.

> Apple engineers have access to private APIs that we do not, that lets them 
> make UINavigationControllers work well with UITabBarControllers. You do not 
> have that, which is why trying to put a UINavigationController into a 
> UIViewController of your own design is going to cause you problems.

Yes, I understand that. I am hoping that those problems are not going to appear 
in this particular app (after all, I'm not using all the power built into tab 
bars and tab bar controllers) or, if they do, as with the status bar gap 
appearing when the device is turned upside down, then I'm hoping the client 
will reconsider their requirements.

I'm sure I'm not the first nor will I be the last developer to bend the rules a 
little in order to satisfy one's clients.


>> In order to accomplish that, I need to be able to change the tab bar's 
>> delegate and list of items and restore them when the navigation controller 
>> returns to its root view. A tab bar managed by a UITabBarController cannot 
>> have its delegate changed, so I'm faking a UITabBarController.
> 
> I tend to agree with others that displaying the experiment modally might be a 
> better UI, but if you don't want to do that, you should still be able to use 
> a UITabBarController and just call -setViewControllers:animated: to change 
> the contents to the tab bar. Just make sure you implement -tabBarItem for 
> each of the view controllers in the array so that you get icons in the tab 
> bar and not just text.

I admit that I hadn't considered your suggestion, and it might satisfy the 
needs of everyone involved. Thanks for offering it.
___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread WT
On Jan 25, 2011, at 8:37 PM, Conrad Shultz wrote:

> I totally agree.  If I understand the OP's design, as a user I would
> find the UITabBar switching out from under me very disturbing and
> confusing.  How would I get back to the previous view?

The navigation bar has a back button. The navigation stack is just two items 
long, the root and the experiment view. The experiment view then reuses the tab 
bar to display any necessary views in addition to the first two (which, as I 
said, are identical in looks and functionality, but not scope, to the first two 
tab items of the front screen tab bar). Thus, going back to the front screen is 
merely one tap on the navigation bar's back button away from any of the 
experiment view tabs.___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread WT
On Jan 25, 2011, at 8:30 PM, Matt Neuburg wrote:

> Here are the ways you can use a tabbed interface, pasted in from the docs:
> 
>   • Install it directly in your application’s main window.
>   • Install it as one of the two root views in a split view interface. 
> (iPad only)
>   • Present it modally to display some data that requires its own 
> mode-based organization.
>   • Display it from a popover. (iPad only)
> 
> The global results and statistics tab bar is the *first* way. The results and 
> statistics for the particular experiment is the *third* way; "some data that 
> requires its own mode-based organization" describes perfectly what it is.
> 
> You can thus structure your entire interface straight from nibs with almost 
> no code at all doing everything by the book. The code would come in as you're 
> about to show the modal interface; you'd populate it with the data and 
> appropriate tabs for the particular experiment the user is about to see.

Yes, that was my first design. I agree that it's the most intuitive for the app 
at hand. However, there are some client requirements that led me to consider 
the other approach. I'm not sold on the design I'm proposing. I'm merely 
exploring options at the moment, working with the client to come to a solution 
that works, is easy to code, won't get rejected when the app is submitted, and 
yet satisfies the client.

I now have a pretty straight-forward test solution based on the design of my 
original message (see project here, if interested: 
). Its only problem, so far as I 
can tell, is that it shows the status bar gap when the device is turned upside 
down, something that Dave Carrigan had mentioned in his first message in this 
thread. If that's the only problem and if the client insists in going this 
route, I'll have to either fix the rotation (hard) or not show the status bar 
(easy, but not as nice).

Believe me, I don't want to waste time trying to get around the API. I'm not 
doing this merely for fun.

WT___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread Dave Carrigan
On Jan 25, 2011, at 2:11 PM, WT wrote:
> On Jan 25, 2011, at 6:41 PM, Matt Neuburg wrote:
> 
>> You asked for further support from the documentation for my statement that 
>> you're using view controllers for views that are going into the wrong sort 
>> of place in your view hierarchy. The devil can quote scripture for his own 
>> purposes, but since one of the view controllers you're misusing is a 
>> UINavigationController, I'll just paste in, directly from the docs, this 
>> convenient list of the places where such a controller is permitted:
>> 
>>  • Install it directly in your application’s main window.
>>  • Install it as the root view controller of a tab in a tab bar 
>> interface.
>>  • Install it as one of the two root view controllers in a split view 
>> interface. (iPad only)
>>  • Present it modally or otherwise use it as a standalone view 
>> controller that you can display and dismiss as needed.
>>  • Display it from a popover. (iPad only)
>> 
>> The place you're putting it is none of those.
> 
> On the contrary. The navigation controller *is* installed as the root view 
> controller of a tab in a tab bar interface. It's installed as the root view 
> controller of tab 0 of the window's root view controller (which implements a 
> tab bar interface).

I don't have your original message any more, but my understanding is that you 
have rolled your own tab bar controller. When the docs say that a 
UINavigationController can be a tab in a tab bar interface, they mean a 
UITabBarController, not a UIViewController that happens to implement a tab bar 
interface. Apple engineers have access to private APIs that we do not, that 
lets them make UINavigationControllers work well with UITabBarControllers. You 
do not have that, which is why trying to put a UINavigationController into a 
UIViewController of your own design is going to cause you problems.

> In order to accomplish that, I need to be able to change the tab bar's 
> delegate and list of items and restore them when the navigation controller 
> returns to its root view. A tab bar managed by a UITabBarController cannot 
> have its delegate changed, so I'm faking a UITabBarController.

I tend to agree with others that displaying the experiment modally might be a 
better UI, but if you don't want to do that, you should still be able to use a 
UITabBarController and just call -setViewControllers:animated: to change the 
contents to the tab bar. Just make sure you implement -tabBarItem for each of 
the view controllers in the array so that you get icons in the tab bar and not 
just text.

-- 
Dave Carrigan
d...@openshut.net
Seattle, WA, USA

___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 1/25/11 2:30 PM, Matt Neuburg wrote:
> 
> On Jan 25, 2011, at 2:11 PM, WT wrote:
> 
>> when you're on the front screen you see
>> 
>> Results | Statistics | App Info
>> 
>> but when you're in a particular experiment, you see
>> 
>> Results | Statistics | Analysis ... (other relevant tabs for this
>> particular experiment)
>> 
>> When you're on the screen for a particular experiment, the tabs
>> apply only to that particular experiment. When you're back to the
>> front screen, the tabs apply to all experiment at once.
> 
> The global results and statistics tab bar is the *first* way. The
> results and statistics for the particular experiment is the *third*
> way; "some data that requires its own mode-based organization"
> describes perfectly what it is.

I totally agree.  If I understand the OP's design, as a user I would
find the UITabBar switching out from under me very disturbing and
confusing.  How would I get back to the previous view?

IIRC, the HIG strongly condemn displaying a UITabBar inside a
UINavigationController's view for similar reasons (whereas the inverse,
presenting a UINavigationController's view from a UITabBar) is perfectly
fine and commonly seen).

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFNP1C1aOlrz5+0JdURAs6tAJ9dZexqGIpROToyOLCZswJKCoHolwCgihdM
tJPMeAVu9yJRDepvZc2aoZw=
=X3yw
-END PGP 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [iPhone] can't get views not to slide off by the height of the status bar

2011-01-25 Thread Matt Neuburg

On Jan 25, 2011, at 2:11 PM, WT wrote:

> when you're on the front screen you see 
> 
> Results | Statistics | App Info
> 
> but when you're in a particular experiment, you see
> 
> Results | Statistics | Analysis ... (other relevant tabs for this particular 
> experiment)
> 
> When you're on the screen for a particular experiment, the tabs apply only to 
> that particular experiment. When you're back to the front screen, the tabs 
> apply to all experiment at once.

> Now, if someone can suggest a similarly intuitive interface that does not 
> need to be coded around the guidelines, I'm all ears (well, ok, eyes).
> 

Here are the ways you can use a tabbed interface, pasted in from the docs:

• Install it directly in your application’s main window.
• Install it as one of the two root views in a split view interface. 
(iPad only)
• Present it modally to display some data that requires its own 
mode-based organization.
• Display it from a popover. (iPad only)

The global results and statistics tab bar is the *first* way. The results and 
statistics for the particular experiment is the *third* way; "some data that 
requires its own mode-based organization" describes perfectly what it is.

You can thus structure your entire interface straight from nibs with almost no 
code at all doing everything by the book. The code would come in as you're 
about to show the modal interface; you'd populate it with the data and 
appropriate tabs for the particular experiment the user is about to see.

m.

--
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread WT
On Jan 25, 2011, at 6:41 PM, Matt Neuburg wrote:

> You should not be using view controllers merely as dumpster divers to load 
> nib files and extract their contents in a semi-automatic way. As I said in my 
> previous note, if you want to store those views in nibs, fine, but then the 
> way to extract those views is with a normal class whose job is to function as 
> the File Owner for the nib and pick up the desired view through an outlet. 
> Using a view controller is wrong because it does all kinds of other stuff not 
> appropriate to this situation.

I fear you didn't completely understand why I'm doing things this way (probably 
my fault since I didn't give a reason for the non-standard design - see the end 
of this message for the reason). I am *not* using view controllers "merely as 
dumpster divers to load nib files." I am using the view controllers to load 
their views and do what those views require their view controllers to do. The 
fact that I am replicating some of the functionality of a tab bar controller 
indicates that I need the view controller to do more than just load a view from 
a nib file. I know very well that view controllers aren't supposed to be used 
just to load stuff from nib files. Please don't make it sound as if that's all 
that I'm doing because it is not.


> You asked for further support from the documentation for my statement that 
> you're using view controllers for views that are going into the wrong sort of 
> place in your view hierarchy. The devil can quote scripture for his own 
> purposes, but since one of the view controllers you're misusing is a 
> UINavigationController, I'll just paste in, directly from the docs, this 
> convenient list of the places where such a controller is permitted:
> 
>   • Install it directly in your application’s main window.
>   • Install it as the root view controller of a tab in a tab bar 
> interface.
>   • Install it as one of the two root view controllers in a split view 
> interface. (iPad only)
>   • Present it modally or otherwise use it as a standalone view 
> controller that you can display and dismiss as needed.
>   • Display it from a popover. (iPad only)
> 
> The place you're putting it is none of those.

On the contrary. The navigation controller *is* installed as the root view 
controller of a tab in a tab bar interface. It's installed as the root view 
controller of tab 0 of the window's root view controller (which implements a 
tab bar interface).

Regardless, that has never been the cause of my problems nor has it been the 
root of your criticism. Your criticism was towards my having a UIViewController 
load a nib that contains other view controllers. That has little or nothing to 
do with (a) faking a tab bar controller (something I'm doing) or with (b) 
having a navigation controller placed where it's not supposed to go (something 
I am not doing).

So much so that I could completely take away the tab bar and the navigation 
controller and, instead, simply have only the "some view controller" of my 
original post (which is just a UIViewController). I would still be having a 
view controller (the window's root view controller) load a nib containing 
another view controller (this time nothing fancier than a vanilla 
UIViewController) and you'd still be making your original criticism. Please 
don't make this problem about something that it is not about.


> Recall that your original note said explicitly that you did *not* want a 
> "just do this" answer; you wanted a more general explanation of what was 
> causing this issue. I provided one, and you immediately rejected it, and 
> abandoned your stated principles and contented yourself with your own "just 
> do this" answer, ending up no wiser than before about how view controllers 
> work and how they are intended to be used. m.

First, your explanation was incorrect, because view controllers need not and do 
not always manage the window root view. Secondly, it was misguided, because you 
thought I was doing something that I am not, namely, use view controllers for 
the sole purpose of loading objects from nib files. Third, I already said in 
another message that I understand the solution. In fact, I already understood 
it even before I posted my original message. What confused me was that I 
thought I had already tried that solution and, so, I was puzzled that it had 
not worked. The truth, of course, was that I had never tried it in the first 
place.



Now, here's why I'm trying this design. Imagine that you have a collection of 
lab experiments for which you want to see some results and some statistics. On 
the app's "front" screen you have a table of those experiments with a *minimal* 
amount of results for each. This is the (global) "results" tab. Now, if you 
switch to the (global) "statistics" tab, you see some statistical information 
about ALL experiments taken as a whole. A third tab might, for example, show 
some app info.

Then you t

Re: [iPhone] can't get views not to slide off by the height of the status bar

2011-01-25 Thread Matt Neuburg
On Tue, 25 Jan 2011 14:05:05 -0200, WT  said:

>While writing this reply, it occurred to me to try something I thought I had 
>tried before but which I had not, namely, to turn off "resize view from nib" 
>for the window root view controller (tabBarVC, in MainWindow.xib) and then 
>make its view (loaded from a separate nib file, containing the fake tab bar 
>controller) 480 pixels tall by not selecting a status bar in the simulated UI 
>elements panel and by setting its frame to (0, 0, 320, 480). Nothing else is 
>changed.
>
>And guess what... it works, which goes to show that just because a design is 
>non-standard, it doesn't mean it's illegal in the sense you were referring to.

That isn't what it goes to show. What it goes to show is that it's possible to 
work around anything. Your views were arriving with a frame.origin.y value of 
20; you could have worked around the problem by setting that to 0 as you put 
the view into the interface. I knew about that, and I knew about the trick you 
are now using, but I purposely didn't tell you about them in my previous note 
(though I did fear that you might discover them anyway). You're just putting a 
band-aid on a self-inflicted wound. The engine warning light on your car has 
come on and you're responding by putting black tape over it. The correct 
procedure is to go back to the root cause, which is how you're obtaining those 
views in the first place.

You should not be using view controllers merely as dumpster divers to load nib 
files and extract their contents in a semi-automatic way. As I said in my 
previous note, if you want to store those views in nibs, fine, but then the way 
to extract those views is with a normal class whose job is to function as the 
File Owner for the nib and pick up the desired view through an outlet. Using a 
view controller is wrong because it does all kinds of other stuff not 
appropriate to this situation.

You asked for further support from the documentation for my statement that 
you're using view controllers for views that are going into the wrong sort of 
place in your view hierarchy. The devil can quote scripture for his own 
purposes, but since one of the view controllers you're misusing is a 
UINavigationController, I'll just paste in, directly from the docs, this 
convenient list of the places where such a controller is permitted:

• Install it directly in your application’s main window.
• Install it as the root view controller of a tab in a tab bar 
interface.
• Install it as one of the two root view controllers in a split view 
interface. (iPad only)
• Present it modally or otherwise use it as a standalone view 
controller that you can display and dismiss as needed.
• Display it from a popover. (iPad only)

The place you're putting it is none of those.

Recall that your original note said explicitly that you did *not* want a "just 
do this" answer; you wanted a more general explanation of what was causing this 
issue. I provided one, and you immediately rejected it, and abandoned your 
stated principles and contented yourself with your own "just do this" answer, 
ending up no wiser than before about how view controllers work and how they are 
intended to be used. m.

--
matt neuburg, phd = m...@tidbits.com, 
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: How to set tab order in a window that has view swapping

2011-01-25 Thread Marc Respass
Hi Abhijeet,

> Hi,I have a single window with a toolbar and a custom view in my application. 
> Toolbar has Back and Next button on it. This is my MainMenu.xib. I have 5 
> more xibs other than the MainMenu.xib in my application. Each xib contains 
> one view with different controls in it. On Next and Back button click on my 
> Main window the current view is swapped with another view. On my first view 
> there is a NSPopupButton. I want when the first view is displayed the 
> keyboard focus should be on NSPopupButton and on tab key press it should move 
> to next control in the tab order. Basically I want my user to be able to use 
> the tab control to change the keyboard focus in all my views.


In IB, set your window to "auto recalculates view loop". To be positive, you 
can also set that on the window when you load your new view. The technique that 
I use for making a particular control first responder is to put a common tag on 
it (say 2112) which you use to get the control without requiring an outlet. 
Then in awake from nib you can do

NSControl *control = [[self view] viewWithTag:2112];
[[[self view] window] makeFirstResponder:control];

if all of your views have a common superclass, you can put that code in the 
superclass.

Hope this helps
Marc
___

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: lots of find/replace in text file

2011-01-25 Thread Matt Neuburg
On Tue, 25 Jan 2011 02:17:46 -0800, Kyle Sluder  said:
>For something more complicated, a simple XML format might be appropriate:
>
>
>The quick  fox jumped over the lazy type="noun" />
>
>
>Especially if you want to share the resulting madlib with other
>people, who might then want to reuse the same template. All that
>information is contained in a nice compact file format:
>
>
>The quick brown fox jumped over the
>lazy dog
>
>
>None of this is all that hard to parse, and increases the robustness
>of the app tremendously.

I was, if you recall, gently prodding at the OP's desire for "efficiency" in 
performing a series of substitutions. You've gone in completely the opposite 
direction from that - and, I think, rightly so. m.

--
matt neuburg, phd = m...@tidbits.com, 
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: @property and Garbage Collection

2011-01-25 Thread Greg Parker
On Jan 25, 2011, at 2:15 AM, Kevin Bracey wrote:
> Yes, I can see the the rule for copy, I'm guessing it still makes a copy.
> 
> I'm a little confused as to what ( retain ) now does, does it now also do a 
> copy, If I remove the ( copy ) I get
> warning: default 'assign' attribute on property 'allImportHeaders' which 
> implements 'NSCopying' protocol not appropriate with -fobjc-gc-only

(retain) and (assign) are identical under GC. (copy) still calls the -copy 
method.


> so I'm unsure should I use the retain or copy keyword for the objects that 
> conform to the 'NSCopying' protocol?


That depends on how your code should behave. Sometimes you want (assign) and 
sometimes you want (copy), even though GC is on. 

When the compiler sees a class that conforms to NSCopying, it requires you to 
explicitly write what you want instead of giving you (assign) by default. The 
hope is that the extra prompt to think about your code and maybe avoid a bug is 
worth the extra keystrokes. 


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

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


Re: Weather API for commercial use in iOS app

2011-01-25 Thread Roger Dalal
I am grateful for your reply, Conrad.

I had seen the stackoverflow.com thread - some useful information there for 
sure.  But I was hoping someone from this list might reply with a specific 
recommendation based on personal experience. Most of the information I have 
found so far are only suggestions (most of which are for companies whose TOS 
requirements specifically exclude commercial use or use on mobile devices). 
Nevertheless, I will look into the NWS/NOAA service as you suggested, and I 
will certainly post back my final conclusions.

Thanks again...

Roger Dalal
Assembled Apps


On Jan 25, 2011, at 12:40 PM, Conrad Shultz wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> Roger Dalal wrote:
>> Good Day, List:
>> 
>> Does anyone have any information regarding the commercial use of a
>> Weather API for iOS apps? I have tried contacting a few of the more
>> popular services (such as weather wunderground) via e-mail, but never
>> receive a response. My preference would be Yahoo, but I can not
>> locate information or a contact to discuss a commercial use license.
>> Also, what are the typical costs (if any) of such services?
>> 
>> Any response will be greatly appreciated.
>> 
> 
> Don't know, but there is a lengthy Stack Overflow discussion that might
> be of interest:
> 
> http://stackoverflow.com/questions/507441/best-weather-apis
> 
> The NWS/NOAA is noted as a data provider described as free for
> commercial use by a Stack Overflow contributor, and though I can't find
> the actual license, works by the federal government are often (but not
> always) free of charge for any use.  I'd probably start there and search
> around, maybe contact them to be safe.
> 
> Good luck - maybe post back when you figure things out?  I'm sure there
> are others who might have the same question.
> 
> - --
> Conrad Shultz
> 
> Synthetiq Solutions
> www.synthetiqsolutions.com
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAk0/CyIACgkQaOlrz5+0JdUvpgCeN2p75TIlmh5Zc4Hk4E+luTOK
> ddAAni58YY4aiN3ZGDbT26KO5z/hPezL
> =lOkv
> -END PGP 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How send XML data to document window?

2011-01-25 Thread Uli Kusterer

On 1/25/11 5:18 PM, McLaughlin, Michael P. wrote:

Question:
What is the recommended method for writing the changed XML to the document
window for user feedback?  I don't want to write the changed XML to a file
and read it back in because most changes are only temporary.


-setStringValue:
___

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: Weather API for commercial use in iOS app

2011-01-25 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Roger Dalal wrote:
> Good Day, List:
> 
> Does anyone have any information regarding the commercial use of a
> Weather API for iOS apps? I have tried contacting a few of the more
> popular services (such as weather wunderground) via e-mail, but never
> receive a response. My preference would be Yahoo, but I can not
> locate information or a contact to discuss a commercial use license.
> Also, what are the typical costs (if any) of such services?
> 
> Any response will be greatly appreciated.
> 

Don't know, but there is a lengthy Stack Overflow discussion that might
be of interest:

http://stackoverflow.com/questions/507441/best-weather-apis

The NWS/NOAA is noted as a data provider described as free for
commercial use by a Stack Overflow contributor, and though I can't find
the actual license, works by the federal government are often (but not
always) free of charge for any use.  I'd probably start there and search
around, maybe contact them to be safe.

Good luck - maybe post back when you figure things out?  I'm sure there
are others who might have the same question.

- --
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAk0/CyIACgkQaOlrz5+0JdUvpgCeN2p75TIlmh5Zc4Hk4E+luTOK
ddAAni58YY4aiN3ZGDbT26KO5z/hPezL
=lOkv
-END PGP 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [iPhone] can't get views not to slide off by the height of the status bar

2011-01-25 Thread WT
I forgot to mention that it's precisely why there may be unforeseen problems 
that I am doing this on a test harness, to see how it comes about before I 
implement this design in the full app.

That's clearly a valid approach. Even if it doesn't work and I have to change 
the design, I learn something valuable.

WT___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread WT
Those are valid arguments, Dave, and I'm grateful that you pointed me to them, 
but not necessarily applicable in all cases. In my specific case, the app only 
supports one orientation (so rotation isn't an issue) and the status bar is 
always visible. I will not categorically claim that this design is the best for 
the application in question and I may very well be forced to change it later 
but there is a specific reason why I'm doing things this way and this is the 
easiest way to satisfy that need.

I want to emphasize once again that the specific problem I was having is not 
due to the design but simply due to the wrong settings for view resizing and 
view sizes. In fact, the solution doesn't just work but I also understand now 
exactly why it works.

Granted, the fact that it works doesn't necessarily justify the choice of 
design but it's also the case that the choice of design doesn't necessarily 
cause the problems I mentioned. In fact, it doesn't. It may cause other 
problems that I can't foresee now but I'll cross that bridge when I get to it.

On Jan 25, 2011, at 2:48 PM, Dave Carrigan wrote:

> From the View Controller Programming Guide:
> 
> "It is recommended that you use only the suggested techniques for displaying 
> the views of your view controllers. In order to present and manage views 
> properly, the system makes a note of each view (and its associated view 
> controller) that you display directly or indirectly. It uses this information 
> later to report view controller-related events to your application. For 
> example, when the device orientation changes, a window uses this information 
> to identify the frontmost view controller and notify it of the change. If you 
> incorporate a view controller’s view into your hierarchy by other means (by 
> adding it as a subview to some other view perhaps), the system assumes you 
> want to manage the view yourself and does not send messages to the associated 
> view controller object."
> 
> This is what you're doing - adding a VC's view as a subview of another VC, 
> and that last sentence means that your VC won't be getting all of the 
> goodness that VCs usually get. While the technique you listed below might 
> have worked, you are still going to run into problems later when you try to 
> handle rotation, or showing/hiding the status bar, etc.
> 
> I've been in the same position as you, trying to write a subclass of 
> UIViewController that acted as a container for other UIViewControllers, and 
> had all of the problems you've listed so far, plus a bunch that you have yet 
> to encounter. 
> 
> On Jan 25, 2011, at 8:05 AM, WT wrote:
>> On Jan 25, 2011, at 8:04 AM, Matt Neuburg wrote:
>> 
>>> No, it's not. What you're doing is very thoroughly illegal, which is why 
>>> you're getting strange results.
>> 
>> I beg to differ and would like you (or someone else) to point me to the part 
>> of the documentation that says that a view controller cannot be made to 
>> mimic a navigation or tab bar controller. If Apple thought that tab bars and 
>> navigation bars could/should only be used within their respective 
>> controllers then they would not have made them available as stand-alone 
>> objects.
>> 
>>> You can't use view controllers this way.
>> 
>> Yes, you can, at least according to the docs.
>> 
>>> A view controller is for the view that backs the whole view structure, the 
>>> root view of the window.
>> 
>> The part after the comma isn't true. According to the docs (The View 
>> Controller Programming Guide for iOS):
>> 
>> "View Controllers Manage a View Hierarchy
>> Each view controller is responsible for managing a discrete part of your 
>> application's user interface. View controllers are directly associated with 
>> a single view object but that object is often just the root view of a much 
>> larger view hierarchy that is also managed by the view controller."
>> 
>> So, the root of that view tree for a given view controller need not be the 
>> window.
>> 
>>> In addition, certain special built-in view controllers and other 
>>> controllers can accept a view controller which they then own and "contain" 
>>> and use to produce their view. But your root view is not controlled by that 
>>> sort of view controller - it isn't a UITabViewController. So it cannot 
>>> obtain its views by way of "contained" view controllers.
>> 
>> And it (the root view controller) doesn't. It's merely a UIViewController, 
>> like any other you'd put in MainWindow.xib. Just as when you use the 
>> View-Based Application template, it loads its view from a separate nib file. 
>> What that view contains is not something its view controller knows or cares 
>> about (at the level of IB). Nothing demands that the root view controller 
>> sitting in MainWindow.xib be a UITabBarController or a 
>> UINavigationController, and nothing in the API constrains what its view 
>> should or should not contain.
>> 
>>> a view loaded by a view controller thinks it will be t

Re: [iPhone] can't get views not to slide off by the height of the status bar

2011-01-25 Thread Dave Carrigan
From the View Controller Programming Guide:

"It is recommended that you use only the suggested techniques for displaying 
the views of your view controllers. In order to present and manage views 
properly, the system makes a note of each view (and its associated view 
controller) that you display directly or indirectly. It uses this information 
later to report view controller-related events to your application. For 
example, when the device orientation changes, a window uses this information to 
identify the frontmost view controller and notify it of the change. If you 
incorporate a view controller’s view into your hierarchy by other means (by 
adding it as a subview to some other view perhaps), the system assumes you want 
to manage the view yourself and does not send messages to the associated view 
controller object."

This is what you're doing - adding a VC's view as a subview of another VC, and 
that last sentence means that your VC won't be getting all of the goodness that 
VCs usually get. While the technique you listed below might have worked, you 
are still going to run into problems later when you try to handle rotation, or 
showing/hiding the status bar, etc.

I've been in the same position as you, trying to write a subclass of 
UIViewController that acted as a container for other UIViewControllers, and had 
all of the problems you've listed so far, plus a bunch that you have yet to 
encounter. 

On Jan 25, 2011, at 8:05 AM, WT wrote:
> On Jan 25, 2011, at 8:04 AM, Matt Neuburg wrote:
> 
>> No, it's not. What you're doing is very thoroughly illegal, which is why 
>> you're getting strange results.
> 
> I beg to differ and would like you (or someone else) to point me to the part 
> of the documentation that says that a view controller cannot be made to mimic 
> a navigation or tab bar controller. If Apple thought that tab bars and 
> navigation bars could/should only be used within their respective controllers 
> then they would not have made them available as stand-alone objects.
> 
>> You can't use view controllers this way.
> 
> Yes, you can, at least according to the docs.
> 
>> A view controller is for the view that backs the whole view structure, the 
>> root view of the window.
> 
> The part after the comma isn't true. According to the docs (The View 
> Controller Programming Guide for iOS):
> 
> "View Controllers Manage a View Hierarchy
> Each view controller is responsible for managing a discrete part of your 
> application's user interface. View controllers are directly associated with a 
> single view object but that object is often just the root view of a much 
> larger view hierarchy that is also managed by the view controller."
> 
> So, the root of that view tree for a given view controller need not be the 
> window.
> 
>> In addition, certain special built-in view controllers and other controllers 
>> can accept a view controller which they then own and "contain" and use to 
>> produce their view. But your root view is not controlled by that sort of 
>> view controller - it isn't a UITabViewController. So it cannot obtain its 
>> views by way of "contained" view controllers.
> 
> And it (the root view controller) doesn't. It's merely a UIViewController, 
> like any other you'd put in MainWindow.xib. Just as when you use the 
> View-Based Application template, it loads its view from a separate nib file. 
> What that view contains is not something its view controller knows or cares 
> about (at the level of IB). Nothing demands that the root view controller 
> sitting in MainWindow.xib be a UITabBarController or a 
> UINavigationController, and nothing in the API constrains what its view 
> should or should not contain.
> 
>> a view loaded by a view controller thinks it will be the root view, in the 
>> window, so it allows 20 pixels for the status bar (the top 20 pixels of the 
>> window are behind the status bar).
> 
> Where is that said in the docs? In fact, what I quoted just above from the 
> docs contradicts your statement. A view loaded by a view controller knows 
> nothing about what part of the window it's about and doesn't make any 
> assumptions about whether there is or there isn't a status bar, for instance. 
> It's the view controller's responsibility to manage all that by positioning 
> and resizing the view as necessary. The view only thinks it's sitting pretty 
> at its frame's (x,y) coordinates and even those are generally not of 
> importance to the view, since everything in the view happens in its bounds 
> rectangle, which has (0,0) for its origin. One can use the simulated UI 
> elements panel to automatically change the view size on IB, but that's the 
> extent of any direct effect the status bar and other such elements have on a 
> view.
> 
> ---
> 
> While writing this reply, it occurred to me to try something I thought I had 
> tried before but which I had not, namely, to turn off "resize view from nib" 
> for the window root view controller (tabBarVC, in

How send XML data to document window?

2011-01-25 Thread McLaughlin, Michael P.
In my app, I read an XML file, init an NSXMLDocument and also display the
file contents in an NSTextField in a document window.  The user can then
change parts of the XML via several dialogs.  The XML data is eventually
sent to subprocesses for computation.

The NSTextField is set to non-editable because some error-checking must be
done with user entries.  Also, some fields are filenames and changing them
involves the FileManager dialog.

Question:
What is the recommended method for writing the changed XML to the document
window for user feedback?  I don't want to write the changed XML to a file
and read it back in because most changes are only temporary.

TIA.

-- 
Mike McLaughlin

___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread WT
On Jan 25, 2011, at 8:04 AM, Matt Neuburg wrote:

> No, it's not. What you're doing is very thoroughly illegal, which is why 
> you're getting strange results.

I beg to differ and would like you (or someone else) to point me to the part of 
the documentation that says that a view controller cannot be made to mimic a 
navigation or tab bar controller. If Apple thought that tab bars and navigation 
bars could/should only be used within their respective controllers then they 
would not have made them available as stand-alone objects.

> You can't use view controllers this way.

Yes, you can, at least according to the docs.

> A view controller is for the view that backs the whole view structure, the 
> root view of the window.

The part after the comma isn't true. According to the docs (The View Controller 
Programming Guide for iOS):

"View Controllers Manage a View Hierarchy
Each view controller is responsible for managing a discrete part of your 
application's user interface. View controllers are directly associated with a 
single view object but that object is often just the root view of a much larger 
view hierarchy that is also managed by the view controller."

So, the root of that view tree for a given view controller need not be the 
window.

> In addition, certain special built-in view controllers and other controllers 
> can accept a view controller which they then own and "contain" and use to 
> produce their view. But your root view is not controlled by that sort of view 
> controller - it isn't a UITabViewController. So it cannot obtain its views by 
> way of "contained" view controllers.

And it (the root view controller) doesn't. It's merely a UIViewController, like 
any other you'd put in MainWindow.xib. Just as when you use the View-Based 
Application template, it loads its view from a separate nib file. What that 
view contains is not something its view controller knows or cares about (at the 
level of IB). Nothing demands that the root view controller sitting in 
MainWindow.xib be a UITabBarController or a UINavigationController, and nothing 
in the API constrains what its view should or should not contain.

> a view loaded by a view controller thinks it will be the root view, in the 
> window, so it allows 20 pixels for the status bar (the top 20 pixels of the 
> window are behind the status bar).

Where is that said in the docs? In fact, what I quoted just above from the docs 
contradicts your statement. A view loaded by a view controller knows nothing 
about what part of the window it's about and doesn't make any assumptions about 
whether there is or there isn't a status bar, for instance. It's the view 
controller's responsibility to manage all that by positioning and resizing the 
view as necessary. The view only thinks it's sitting pretty at its frame's 
(x,y) coordinates and even those are generally not of importance to the view, 
since everything in the view happens in its bounds rectangle, which has (0,0) 
for its origin. One can use the simulated UI elements panel to automatically 
change the view size on IB, but that's the extent of any direct effect the 
status bar and other such elements have on a view.

---

While writing this reply, it occurred to me to try something I thought I had 
tried before but which I had not, namely, to turn off "resize view from nib" 
for the window root view controller (tabBarVC, in MainWindow.xib) and then make 
its view (loaded from a separate nib file, containing the fake tab bar 
controller) 480 pixels tall by not selecting a status bar in the simulated UI 
elements panel and by setting its frame to (0, 0, 320, 480). Nothing else is 
changed.

And guess what... it works, which goes to show that just because a design is 
non-standard, it doesn't mean it's illegal in the sense you were referring to. 
As I suspected, nothing in the docs prohibits the design I have, nor anything 
suggests that it shouldn't be done. Moreover, also as I claimed, the 20-pixel 
slide has nothing to do with faking a tab bar controller.

Thank you for your reply, Matt. Although incorrect, your argument prompted me 
to try something (which I thought I had done before) and the problem is now 
solved.

For future reference, here's a link to the test project containing the fix:

http://www.restlessbrain.com/NavTest_fixed.zip

WT

___

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: @property and Garbage Collection

2011-01-25 Thread James Bucanek
Kevin Bracey  wrote (Tuesday, January 
25, 2011 2:59 AM +1300):



In a Garbage Collected App when using the @property is it correct that I still
have to specify (copy) or (retain) or have I missed something? I thought using
GC didn't require retain and that everything could just be assigned, but the
complier complains.


You're correct; GC doesn't require retain, and retain in a GC 
environment is a no-op.


In general, however, I'd suggest ignoring whether the 
environment is GC or not. Specify assign, copy, or retain based 
on the usage pattern of the property. That way, if you find 
yourself in a non-GC environment, it will still work.


While I write my properties this way, I may omit the 
retain/release messages in my code if I'm _sure_ it will never 
see a non-GC environment. But even when I'm writing a GC 
application, if the classes have utility beyond this 
application, and there's a reasonable chance that I'd like to 
use them in a non-GC environment, I'll write full retain/release 
code so that's functional in both.


--
James Bucanek

___

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: Loading the Foundation at runtime

2011-01-25 Thread Jean-Daniel Dupas

Le 25 janv. 2011 à 14:55, Fritz Anderson a écrit :

> On 24 Jan 2011, at 10:39 AM, Mathieu Suen wrote:
> 
>> int
>> main ()
>> {
>> int error;
>> objc_loadModule ("Foundation", onLoad, &error);
>> return EXIT_SUCCESS;
>> }
>> --objc-test.c--
>> 
>> But the linker complain:
>> 
>> Undefined symbols:
>> "_objc_loadModule", referenced from:
>>_main in ccX2yu3T.o
>> ld: symbol(s) not found
>> 
>> I have compile it using the command:
>> gcc objc-test.c -g -lobjc -o test
> 
> According to nm, the symbol objc_loadModule does not appear in libobjc.dylib 
> in at least my installation of 10.6.6. The delta notes for 10.5 in the 
> runtime reference says the function is deprecated. 
> 

nm -arch i386 libobjc.dylib works.

This symbol is effectively not available int the 64bit runtime.

-- Jean-Daniel




___

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: Loading the Foundation at runtime

2011-01-25 Thread Fritz Anderson
On 24 Jan 2011, at 10:39 AM, Mathieu Suen wrote:

> int
> main ()
> {
> int error;
> objc_loadModule ("Foundation", onLoad, &error);
> return EXIT_SUCCESS;
> }
> --objc-test.c--
> 
> But the linker complain:
> 
> Undefined symbols:
> "_objc_loadModule", referenced from:
> _main in ccX2yu3T.o
> ld: symbol(s) not found
> 
> I have compile it using the command:
> gcc objc-test.c -g -lobjc -o test

According to nm, the symbol objc_loadModule does not appear in libobjc.dylib in 
at least my installation of 10.6.6. The delta notes for 10.5 in the runtime 
reference says the function is deprecated. 

It doesn't show up in my copy of the 10.5 SDK, either, which I find strange. 
I'd think if it were merely deprecated, and certainly for backward 
compatibility, it should still be in the library.

The documentation says you should use NSBundle or dyld functions instead.

— F

___

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: How to set tab order in a window that has view swapping

2011-01-25 Thread Michael Babin

On Jan 25, 2011, at 1:21 AM, Abhijeet Singh wrote:

> Hi,I have a single window with a toolbar and a custom view in my application. 
> Toolbar has Back and Next button on it. This is my MainMenu.xib. I have 5 
> more xibs other than the MainMenu.xib in my application. Each xib contains 
> one view with different controls in it. On Next and Back button click on my 
> Main window the current view is swapped with another view. On my first view 
> there is a NSPopupButton. I want when the first view is displayed the 
> keyboard focus should be on NSPopupButton and on tab key press it should move 
> to next control in the tab order. Basically I want my user to be able to use 
> the tab control to change the keyboard focus in all my views.

See -[NSView nextKeyView] and 
friends.___

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: Disable (grey out) main menu when displaying modal window?

2011-01-25 Thread Darren Wheatley
Hi,

The answer is to implement the NSUserInterfaceValidations protocol.

The one method I needed to implement was:

- (BOOL)valildateUserInterfaceItem:

Returning NO disables the referenced menu item.

All works fine now.

Darren.



On 25/01/2011 08:45, "Darren Wheatley" 
wrote:

>Hi,
>
>I load a custom file import window in my Cocoa app using:
>
>[NSApp runModalForWindow:window];
>
>The window displays just fine, and is modal.
>
>However, the application main menu is still active (e.g. File menu and
>items), which is making the modal display redundant.
>
>I've googled this and searched the docs, but can't find a way to turn the
>menu off.
>
>Someone suggested using this:
>
>NSModalSession session = [NSApp beginModalSessionForWindow:window];
>[NSApp runModalSession];
>
>- but that doesn't seem to work either. Again, the window displays but the
>main menu is still active.
>
>Can anyone suggest how I turn the main menu off (grey out all menu items)
>when displaying a modal window please?
>
>Thanks
>
>Darren.
>
>
>___
>
>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/darren%40tenjinconsulting
>.co.uk
>
>This email sent to dar...@tenjinconsulting.co.uk


___

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: @property and Garbage Collection

2011-01-25 Thread Quincey Morris
On Jan 25, 2011, at 02:15, Kevin Bracey wrote:

> I'm a little confused as to what ( retain ) now does, does it now also do a 
> copy, If I remove the ( copy ) I get
> warning: default 'assign' attribute on property 'allImportHeaders' which 
> implements 'NSCopying' protocol not appropriate with -fobjc-gc-only

It's a not-quite-bug in the compiler. The compiler helpfully assumes that if 
the property value class implements NSCopying, then it's an immutable value 
(like NSString), and therefore the 'copy' attribute should be specified 
(instead of the default 'assign' -- and remember that 'assign' and 'retain' are 
the same thing under GC).

The problem is that this assumption is not necessarily true, not even most of 
the time. For many classes, it's irrelevant to their mutability whether they 
implement NSCopying or not.

So, if specify 'copy' if that's what you want, otherwise specify 'assign' 
explicitly to shut the compiler up.


___

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: WebKit WebArchive Create but no Load?

2011-01-25 Thread Mike Abdullah
-[WebFrame loadArchive:]

On 25 Jan 2011, at 04:29, Bruce Cresanta wrote:

> Hello,
> 
> It is rather straightforward to create a webarchive in Cocoa:
> 
> WebArchive* archive = [[[webArchive mainFrame] dataSource] webArchive]
> 
> However... Once you have this archive, there seems to be no way to load it 
> back into the webview.
> 
> Am I missing something??
> 
> Any guidance is very much appreciated.
> 
> Thank you,
> 
> Bruce
> ___
> 
> 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/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.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: lots of find/replace in text file

2011-01-25 Thread Kyle Sluder
On Tue, Jan 25, 2011 at 1:56 AM, Matt Neuburg  wrote:
> This is madlibs; the template string comes from him, the programmer. Only the 
> words that go into the blanks come from the user. You'll need to prove to me 
> that performing the substitution this way is any more dangerous than 
> substituting words from the user into the template string some other way. m.

As I said, just because he writes the template string doesn't mean he
(or his localization author) is immune to accidentally adding an extra
%@ into the file that causes access to random memory. That's an
embarrassing crasher right there that can be avoided with something as
simple as not directly reading format strings from a file.

And in the future, even with a very simple infrastructure, if he
wishes to allow third-party file authorship, then users don't need to
worry about some troll handing them an intentionally malformed file
designed to crash the app, or worse gain elevated privileges or put
the operating system in an unstable state.

A simple plist-based approach using an array of dictionaries would
work. In old ASCII-plist syntax:

(
  {
IsBlank=NO;
Text="The quick"
  },
  {
IsBlank=YES;
Text="(adjective)"
  },
  {
IsBlank=NO;
Text="fox jumped over the lazy"
  },
  {
IsBlank=YES;
Text="(noun)"
  }
)

For something more complicated, a simple XML format might be appropriate:


The quick  fox jumped over the lazy 


Especially if you want to share the resulting madlib with other
people, who might then want to reuse the same template. All that
information is contained in a nice compact file format:


The quick brown fox jumped over the
lazy dog


None of this is all that hard to parse, and increases the robustness
of the app tremendously. This is especially relevant if Jeremy is
merely using MadLibs as an allegory to describe a more complicated
application, like an app that creates and fills out boilerplate legal
documents.

--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: @property and Garbage Collection

2011-01-25 Thread Kevin Bracey
Yes, I can see the the rule for copy, I'm guessing it still makes a copy.

I'm a little confused as to what ( retain ) now does, does it now also do a 
copy, If I remove the ( copy ) I get
warning: default 'assign' attribute on property 'allImportHeaders' which 
implements 'NSCopying' protocol not appropriate with -fobjc-gc-only

so I'm unsure should I use the retain or copy keyword for the objects that 
conform to the 'NSCopying' protocol?

Also I was retaining IBOutlets before CG but I'm unsure what to do with them as 
they don't mind being assigned.

Thanks
Kevin

On 25/01/2011, at 11:03 PM, Thomas Davie wrote:

> 
> On 25 Jan 2011, at 09:59, Kevin Bracey wrote:
> 
>> Hi Guys,
>> 
>> I've been using Retain/Release up til now but I have started my first GC 
>> project.
>> 
>> In a Garbage Collected App when using the @property is it correct that I 
>> still have to specify (copy) or (retain) or have I missed something? I 
>> thought using GC didn't require retain and that everything could just be 
>> assigned, but the complier complains.
> 
> There is still a semantic difference between simply keeping hold of a 
> reference to something, and copying that something, even if you have a neat 
> tool keeping track of whether you still hold a reference.
> 
> Bob

___

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] can't get views not to slide off by the height of the status bar

2011-01-25 Thread Matt Neuburg
On Mon, 24 Jan 2011 22:36:51 -0200, WT  said:
>Hello list,
>
>I have the following view hierarchy in an iPhone test app:
>
>window
>  status bar
>  view managed by a tab bar with 2 tabs
>view for tab 0: some view, managed by some view controller
>view for tab 1: one of a set of views, managed by a navigation controller
>  tab bar
>
>In more detail, MainWindow.xib has a UIViewController (tabBarVC) masquerading 
>as a UITabBarController, that is, the view it's responsible for has a UITabBar 
>along with a "content" view (held by an ivar called 'dataView') which is where 
>the tab bar puts the contents of each tab.
>
>[ Yes, I know I could (and possibly/probably should) use a bona-fide 
>UITabBarController but I need to be able to manipulate the tab bar in some 
>ways, which is something you can't do with the tab bar attached to a tab bar 
>controller. Regardless of the wisdom (or lack thereof) of this design, the 
>problem I'm having is not due to using a stand-alone tab bar, as you'll see in 
>a moment. ]
>
>The view managed by tabBarVC is loaded from a nib file (TabBarVC.xib) and 
>contains the view itself (with the tab bar and dataView as subviews) and two 
>view controllers, one for each tab (SomeVC and NavVC). The views they manage 
>(some view and the root view for the navigation controller) are loaded from 
>separate nib files.
>
>It's all very straight-forward, actually

No, it's not. What you're doing is very thoroughly illegal, which is why you're 
getting strange results. You can't use view controllers this way. A view 
controller is for the view that backs the whole view structure, the root view 
of the window. In addition, certain special built-in view controllers and other 
controllers can accept a view controller which they then own and "contain" and 
use to produce their view. But your root view is not controlled by that sort of 
view controller - it isn't a UITabViewController. So it cannot obtain its views 
by way of "contained" view controllers.

This explains the incorrect positioning of the views - a view loaded by a view 
controller thinks it will be the root view, in the window, so it allows 20 
pixels for the status bar (the top 20 pixels of the window are behind the 
status bar). But this is merely symptomatic. It's lucky it happened, since 
you'd be in deep trouble if you want further down this road. Back off now and 
start over. You can certainly swap views into your interface on demand; but 
then just *do* it, without the spurious view controllers. If you want to keep 
those views in nibs in order to save memory until you need them, fine, but 
you'll have to load those nibs yourself and extract the views from them 
yourself and manage those views yourself.

m.

--
matt neuburg, phd = m...@tidbits.com, 
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: @property and Garbage Collection

2011-01-25 Thread Thomas Davie

On 25 Jan 2011, at 09:59, Kevin Bracey wrote:

> Hi Guys,
> 
> I've been using Retain/Release up til now but I have started my first GC 
> project.
> 
> In a Garbage Collected App when using the @property is it correct that I 
> still have to specify (copy) or (retain) or have I missed something? I 
> thought using GC didn't require retain and that everything could just be 
> assigned, but the complier complains.

There is still a semantic difference between simply keeping hold of a reference 
to something, and copying that something, even if you have a neat tool keeping 
track of whether you still hold a reference.

Bob___

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


@property and Garbage Collection

2011-01-25 Thread Kevin Bracey
Hi Guys,

I've been using Retain/Release up til now but I have started my first GC 
project.

In a Garbage Collected App when using the @property is it correct that I still 
have to specify (copy) or (retain) or have I missed something? I thought using 
GC didn't require retain and that everything could just be assigned, but the 
complier complains.

cheers
Kevin___

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: lots of find/replace in text file

2011-01-25 Thread Matt Neuburg

On Jan 24, 2011, at 6:54 PM, Kyle Sluder wrote:

> On Jan 24, 2011, at 6:02 PM, Matt Neuburg  wrote:
> 
>> 
>> (2) A common trick is make the text file a format string (i.e., containing a 
>> lot of %@) and just hand it to stringWithFormat along with all the 
>> substitutions. Badda bing badda boom.
> 
> This is how security vulnerabilities are born. You are handing off formatting 
> strings to functions that trust you are supplying the correct number and type 
> of arguments to match, or else they will blithely access random chunks of 
> memory.
> 
> If you are at all accepting arbitrary input files, you must not simply hand 
> the text over as a formatting specifier. Even if you're building an iOS app 
> and bundling all the possible files yourself, do yourself a favor and build a 
> more robust parser now.
> 
> There's no sense in writing intentionally fragile code that will (not "may") 
> result in a crasher and irate customers sometime in the future when someone 
> accidentally puts one to many %@ sequences in the MadLib file.
> 

This is madlibs; the template string comes from him, the programmer. Only the 
words that go into the blanks come from the user. You'll need to prove to me 
that performing the substitution this way is any more dangerous than 
substituting words from the user into the template string some other way. m.

--
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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


Disable (grey out) main menu when displaying modal window?

2011-01-25 Thread Darren Wheatley
Hi,

I load a custom file import window in my Cocoa app using:

[NSApp runModalForWindow:window];

The window displays just fine, and is modal.

However, the application main menu is still active (e.g. File menu and
items), which is making the modal display redundant.

I've googled this and searched the docs, but can't find a way to turn the
menu off.

Someone suggested using this:

NSModalSession session = [NSApp beginModalSessionForWindow:window];
[NSApp runModalSession];

- but that doesn't seem to work either. Again, the window displays but the
main menu is still active.

Can anyone suggest how I turn the main menu off (grey out all menu items)
when displaying a modal window please?

Thanks

Darren.


___

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: Loading the Foundation at runtime

2011-01-25 Thread Jean-Daniel Dupas

Le 24 janv. 2011 à 17:39, Mathieu Suen a écrit :

> Hi All,
> 
> In other to write a binding for a language I need to load the Foundation 
> framework at run time.
> So just to test I wrote a simple example:
> 
> --objc-test.c--
> #include 
> #include 
> #include 
> 
> void
> onLoad (Class this, char* inCat)
> {
>printf ("Loading %s in %s\n", class_getName (this), inCat);
> }
> 
> 
> 
> int
> main ()
> {
>  int error;
>  objc_loadModule ("Foundation", onLoad, &error);
>  return EXIT_SUCCESS;
> }
> --objc-test.c--
> 
> But the linker complain:
> 
> Undefined symbols:
>  "_objc_loadModule", referenced from:
>  _main in ccX2yu3T.o
> ld: symbol(s) not found
> 
> I have compile it using the command:
> gcc objc-test.c -g -lobjc -o test
> 
> Thanks for help
> 
> Mathiue
> 

Obj-C runtime functions are in the libobjc that you should include to your 
project.



-- Jean-Daniel




___

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