Re: Regarding MVC design pattern

2010-05-16 Thread Quincey Morris
On May 15, 2010, at 10:56, Sai wrote:

>  Suppose I have an iPhone application follow
> the MVC design pattern.
> The Model is presented by an custom object. And I have declared an instance
> of the Model Object as a IBOutlet
> in my Controller class. I found that every time I start my application, this
> instance of Model Object will be initialized.
> My first question is who called this init method, what for?

You seem to be saying you "instantiated" your data model by adding a custom 
object (blue cube) to your XIB file in IB, and changing its class to Model, 
with your Controller class as File's Owner.

When you do that, IB creates an instance of Model for you, whenever that XIB 
file is loaded. We don't know *when* it's being loaded, because you didn't tell 
us which XIB file, or give any information about Controller. (An application 
can have lots of controllers. Some may exist for the life of the application. 
Some may exist only while a window or view exists. Some may have other 
lifetimes.)

So the answer to your first question:

Your Model is being initialized because the NIB file that contains it is being 
loaded. The gory details of what happens can be found here:


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html

> As I found that it will be initialized automatically, so I just send message
> for that instance, and crashed at runtime
> with a exc_bad_access signal error. So I have to call alloc and init for
> that Model Object and assign the returned
> instance to the IBOutlet variable, then everything runs well.
> My second question is if I have to allocate and initialized that Model
> Object for myself? Is it over-done for this
> initialization because it is called automatically before.

We don't have enough information to answer this question. Almost certainly, 
this is a memory management error. The Model object is getting deallocated too 
early.

Or, you're trying to reference your Model object too early: since it's created 
when the NIB is loaded, it doesn't exist until after the NIB is loaded.

> My third question is where I should call the release method for this
> instance of Model Object?

Probably never.

If the Model exists for the life of your application, then you never need to 
release 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: Regarding MVC design pattern

2010-05-16 Thread Henry McGilton

On May 15, 2010, at 10:56 AM, Sai wrote:

> Hi All,
> I am new to cocoa development. Suppose I have an iPhone application follow
> the MVC design pattern.
> The Model is presented by an custom object. And I have declared an instance
> of the Model Object as a IBOutlet
> in my Controller class.

One assumes from your description here that there is a custom object in your 
XIB document.
And, as you said, your Controller class has an IBOutlet declaration for the 
Model.

Is there an instance of your Controller class in the XIB document?
Did you connect that Controller's Model IBOutlet to the Model object itself 
using Interface Builder?

If it's not connected in the XIB document, you need to make the connection, and 
then the alloc and init
you do as described below is no longer necessary.


> I found that every time I start my application, this
> instance of Model Object will be initialized.
> My first question is who called this init method, what for?

The alloc and init are called when the NIB is loaded.

> 
> As I found that it will be initialized automatically, so I just send message
> for that instance, and crashed at runtime
> with a exc_bad_access signal error. So I have to call alloc and init for
> that Model Object and assign the returned
> instance to the IBOutlet variable, then everything runs well.

> My second question is if I have to allocate and initialized that Model
> Object for myself? Is it over-done for this
> initialization because it is called automatically before.

Yes, but if you had made the connection from Controller to Model in the XIB 
document,
you would not need to alloc and init a new instance.

> My third question is where I should call the release method for this
> instance of Model Object?

You release the Model object when you no longer need it. 

Best Wishes,
. . . . . . . .Henry

___

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


TIPS : Using Add2Project to organize your projects more effectively.

2010-05-16 Thread Bill Hernandez
http://www.journey-of-flight.com/index.php

Cocoa - Using Add to Project to Organize Your Projects More Effectively.  
Use Xcode Add2Project to automatically create a folder hierarchy that matches 
the Groups and Files virtual hierarchy... 

or you can reach the page directly at :

http://www.journey-of-flight.com/bh_xcode/how-to/0016_Add2Project/index.php

I also added quite a few items to the resources link at :

http://www.journey-of-flight.com/bh_xcode/common/cocoa_programming_resources.php

if you see any that I should add, please let me know.

Hope this is useful

Bill Hernandez
Plano, Texas___

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


Regarding MVC design pattern

2010-05-16 Thread Sai
Hi All,
I am new to cocoa development. Suppose I have an iPhone application follow
the MVC design pattern.
The Model is presented by an custom object. And I have declared an instance
of the Model Object as a IBOutlet
in my Controller class. I found that every time I start my application, this
instance of Model Object will be initialized.
My first question is who called this init method, what for?

As I found that it will be initialized automatically, so I just send message
for that instance, and crashed at runtime
with a exc_bad_access signal error. So I have to call alloc and init for
that Model Object and assign the returned
instance to the IBOutlet variable, then everything runs well.
My second question is if I have to allocate and initialized that Model
Object for myself? Is it over-done for this
initialization because it is called automatically before.

My third question is where I should call the release method for this
instance of Model Object?

Sorry that my English may not be good enough to make things clear. Hope you
guys can understand my situation.
Thanks a lot for your help and time in advance.

best regards,
ico
___

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: Selecting rows in NSOutlineView from menuForEvent:?

2010-05-16 Thread Ryan C. Payne
On Apr 9, 2010, at 15:17, Nick Zitzmann wrote:

> 
> On Apr 9, 2010, at 3:42 PM, Laurent Daudelin wrote:
> 
>> However, the selection is the standard highlight, not the outline I see in 
>> any other table views in other Apple applications.
> 
> I think the "drop highlighting" thing a few Apple apps do is accomplished 
> through a private API. I wouldn't worry about it too much, since you'd be 
> amazed at how many people don't even know that contextual menus exist (unless 
> your target market is exclusively power users), but you can probably do this 
> yourself by overriding the row drawing method to draw a similar-looking 
> bezier path over the top of the row.


I was looking into this myself, as I like the little ovally highlight that you 
get in 10.6 when you right click on items in a table view other than the 
currently selected item. I have the need to be able to return different menus 
based on the item that I am right clicking on and to accomplish that I had 
overridden menuForEvent. I was disappointed that I didn't get that fancy 10.6 
highlight when doing so. However, I have found that if you call [super 
menuForEvent:event] in your overridden method, you will still get the ovally 
highlight.

One point to note, however, is that doing that on 10.5 and *not* selecting the 
row causes you to get a box highlight on the row, with an empty background. So 
in the end I am doing a check to see if I am running on 10.5. If I am, I just 
change the row selection to the row where the event was fired and then do my 
menu determination. If it's not 10.5, I call the [super menuForEvent:event] 
call and go on my merry way.

Hope that helps,

Ryan___

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: creating a UITableView on an "Utility application" project

2010-05-16 Thread Fritz Anderson
On 16 May 2010, at 5:06 PM, Alejandro Aragón wrote:

> In the interface builder, I assigned the DetailViewController class to the
> view. Now, in the FlipsideViewController class, I added the function that is
> supposed to handle the action when the user clicks on a row:

You should have set the class of _File's Owner_ to DetailViewController, not 
the view, and linked the controller's "view" outlet to the view.

> When I run the application, nothing happens when the user clicks on the row
> of a table view. Can someone tell me what I am missing here?

(A minor annoyance: Users of iPhone OS applications can't click: They don't 
have mice. They touch or tap.)

What do you see as you step from your debugger breakpoints at 
tableView:didSelectRowAtIndexPath: and -[DetailViewController 
initWithNibName:bundle:]? Did any messages appear on the Debugger Console that 
might indicate that UIKit found an error? Are all the pointers you are assuming 
are not nil, in fact not nil?

— 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: new to cocoa

2010-05-16 Thread Charles Srstka
On May 16, 2010, at 8:08 PM, Kyle Sluder wrote:

>> [sourceButtonMap setObject:[NSString stringWithString:@"no"]
>> forKey:[unitButton description]];
> 
> This is a bad idea. Who knows what -description returns? Using a
> textual description of an object intended for debugging in place of
> the actual object is needlessly complex and just plain wrong.

You could probably use an NSMapTable — with the appropriate options, it could 
be set to retain its keys instead of copying them. It might be a good idea to 
see if there’s a better way to do what you’re doing, though — mapping buttons 
to arbitrary objects like that doesn’t strike me as being the best way to do 
things.

Charles___

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: new to cocoa

2010-05-16 Thread Andy Lee
In addition to what others have pointed out...

On May 16, 2010, at 8:19 PM, William Squires wrote:
> [sourceButtonMap setObject:[NSString stringWithString:@"no"] 
> forKey:[unitButton description]];

...there's no reason to use stringWithString:.  You can just say:

[sourceButtonMap setObject:@"no" forKey:[unitButton description]];

--Andy

___

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: new to cocoa

2010-05-16 Thread Jens Alfke

On May 16, 2010, at 5:19 PM, William Squires wrote:

> I believe keys in an NSDictionary/NSMutableDictionary are NSStrings

This is true in a property list; the serializer only knows how to read/write 
strings as dictionary keys. But in memory (or if you’re using the more powerful 
NSArchiver) you can use any copyable object as a dictionary key.

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: new to cocoa

2010-05-16 Thread Kyle Sluder
On Sun, May 16, 2010 at 5:19 PM, William Squires  wrote:
> I believe keys in an NSDictionary/NSMutableDictionary are NSStrings; they're
> just descriptive tags you attach (or associate) with an object (the
> "value"). What you need is

Any object can be a key in an NSDictionary, but NSDictionary always
copies its keys. Its toll--free bridged companion, CFDictionary, can
be configured to just retain/release the keys instead.

> [sourceButtonMap setObject:[NSString stringWithString:@"no"]
> forKey:[unitButton description]];

This is a bad idea. Who knows what -description returns? Using a
textual description of an object intended for debugging in place of
the actual object is needlessly complex and just plain wrong.

--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: NSTreeController and remove:

2010-05-16 Thread Tony Romano
Ok, here is the magical answer as to why the remove: didn't work.  Nice little 
warning in the Cocoa Bindings Programming topic:

Warning: Providing the count key path to an NSTreeController instance disables 
the add:,addChild:, remove:, removeChild:, orinsert: methods.

My object implemented a method to retrieve the count and I set it in the 
controller.What the warning doesn't mention, it also causes CanAdd and 
CanRemove to always return no.  So, if anyone is having problems with binding 
these methods to their buttons and they are disabled, this can also be a reason 
why.

-Tony

On May 15, 2010, at 8:25 AM, Mike Abdullah wrote:

> As he stated, -remove: does work, but its result is deferred.
> 
> On 15 May 2010, at 03:56, Tony Romano wrote:
> 
>> Thanks Quincey.
>> 
>> removeObjectAtArrangedObjectIndexPath works but remove: still does not.  It 
>> should remove the object, if there is a bug then I will file a bug report.  
>> anyone have ideas as to why remove: may not be working.  I hate to find 
>> another way and drop a possible issue/bug.  Thanks.
>> 
>> -Tony
>> 
>> 
>> On May 14, 2010, at 4:55 PM, Quincey Morris wrote:
>> 
>>> On May 14, 2010, at 15:39, Tony Romano wrote:
>>> 
 I have a NSOutlineView bound to a NSTreeController in class mode(i.e. each 
 NSTreeNode represents my Node object).  Everything up to now is working 
 fine.  I am trying to remove a single node in the outline view by calling 
 [outlineView remove:self] as a test.  The documents are pretty simple and 
 they state that the remove: method removes the selected item, simple 
 enough.  I've put some test code around the remove.  The test code is 
 looking at the selected node Before the remove then looking at the 
 selected node again(assuming the controller picked a new selection).  The 
 before and after are the same which is also reflected in the UI.  I 
 verified this in the debugger.  Here's the snippet.
 
...
NSArray * selectedObjects = [outlineController selectedObjects];
 
// Only selecting one node for the test, it should be at index 0.
Node * node = [selectedObjects objectAtIndex:0];
NSIndexPath * paths = [outlineController selectionIndexPath];
 
[outlineController remove:self];
selectedObjects = [outlineController selectedObjects];
 
node = [selectedObjects objectAtIndex:0];
 
paths = [outlineController selectionIndexPath];
 
 
 The canRemove binding which is hooked up to the menu item, is working(Menu 
 Item is enabled).  Is there some setting I am completely overlooking. 
 Searching has come up empty handed.
>>> 
>>> You read the documentation for 'remove:' but apparently not all of it:
>>> 
 Special Considerations
 Beginning with Mac OS X v10.4 the result of this method is deferred until 
 the next iteration of the runloop so that the error presentation mechanism 
 can provide feedback as a sheet.
>>> 
>>> So of course it hasn't been done when you check immediately after invoking 
>>> the 'remove:' action. If you want it to happen immediately, you would need 
>>> to use 'removeObjectAtArrangedObjectIndexPath:' instead.
>>> 
>>> But ...
>>> 
>>> Depending on where this code is, it may be a lousy idea to do the removal 
>>> via the tree controller anyway. You're always better off changing the data 
>>> model directly (the thing that is providing the tree controller with 
>>> content).
>>> 
>>> If I say this often enough, one day someone might listen.
>>> 
>>> 
>>> 
>>> ___
>>> 
>>> 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/tonyrom%40hotmail.com
>>> 
>>> This email sent to tony...@hotmail.com
>>> 
>> 
>> -Tony
>> 
>> ___
>> 
>> 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
> 
> 

-Tony

___

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: new to cocoa

2010-05-16 Thread William Squires
I believe keys in an NSDictionary/NSMutableDictionary are NSStrings;  
they're just descriptive tags you attach (or associate) with an  
object (the "value"). What you need is


[sourceButtonMap setObject:[NSString stringWithString:@"no"] forKey: 
[unitButton description]];


though you'll have to subclass UIButton and implement a description  
method in it for this to do much good.


On May 11, 2010, at 3:36 PM, Alejandro Marcos Aragón wrote:


Hi all,

I'm new to Cocoa, and I couldn't find information about an error  
that I'm getting on the web. I'm trying to create an  
NSMutableDictionary where the keys are of type UIButton*:



// create button for unit
UIButton* unitButton = [[UIButton alloc] init];
			[sourceButtonMap setObject:[NSString stringWithString:@"no"]  
forKey:unitButton];


Of course, the sourceButtonMap is defined in the class and  
initialized in the init function as sourceButtonMap =  
[[NSMutableDictionary alloc] init];


The error I get when I try to add the key-value pair is:

*** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: '*** -[UIButton  
copyWithZone:]: unrecognized selector sent to instance 0x3931e90'


Is this happening because I can't store UIButton* as keys?
Can anyone point me why I'm getting this error? Thank you all,

aa___

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

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


Re: UI blocking

2010-05-16 Thread Charles Srstka
On May 16, 2010, at 3:37 PM, Tobias Jordan wrote:

> Hey guys,
> 
> I have a CA transition running which obviously doesn't support any blocking 
> modes (CABasicAnimation). I must block the UI during the transition so the 
> user can't click somewhere and something unexpected happens. I think all 
> animations in OS X are blocking the UI, for example minimizing a window going 
> into the dock. Question, is there a way to block the UI / main thread or 
> maybe just a window? I tried using usleep but looks like the animation and 
> its drawing view don't like that. I can't believe there's no 
> 'setBlockingMode' or something like that for CAAnimation.
> 
> Thanks in advance!

Would running in a different run loop mode work for what you want to do?

Charles___

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


Fwd: creating a UITableView on an "Utility application" project

2010-05-16 Thread Alejandro Aragón
Hi everyone,

I'm new to iPhone development and I'm really stuck at this point. I
apologize for the lengthy email, but I wanted to provide all the relevant
code. I've been trying to add a UITableView to an existing Utility
Application programmatically. In order to add the UITableView to the flip
side, I basically changed the interface definition of the
FlipSideViewController so that class is also the data source and the
delegate of the table view:

@interface FlipsideViewController : UIViewController  {
...


Then, in the viewDidLoad method, I added the UITableView programmatically:

@implementation FlipsideViewController
...

- (void)viewDidLoad {



[super viewDidLoad];

 // create table view
UITableView *unitTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,
40, 320, 320) style:UITableViewStyleGrouped];


unitTableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|
UIViewAutoresizingFlexibleWidth;
unitTableView.delegate = self;
unitTableView.dataSource = self;


[unitTableView reloadData];


[self.view addSubview:unitTableView];
[unitTableView release];
}


Up to this point everything goes fine, the table view shows up but it has no
functionality. Now the problem that I'm facing:
I want each one of the rows in the table view to display some additional
information, so I created a detail view so that the application transitions
to it when a user clicks on a row. I then created a DetailView.xib, and a
DetailViewController.

@interface DetailViewController : UIViewController {

int row;
IBOutlet UILabel *message;


}

@property (readwrite) int row;
@property (nonatomic, retain) IBOutlet UILabel *message;

@end


@implementation DetailViewController

@synthesize row;
@synthesize message;


 // The designated initializer.  Override if you create the controller
programmatically and want to perform customization that is not appropriate
for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil
bundle:(NSBundle*)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
{
}

   return self;
}

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];

}

- (void)viewDidUnload {
[super viewDidUnload];
}


- (void)dealloc {
[super dealloc];
}


@end


In the interface builder, I assigned the DetailViewController class to the
view. Now, in the FlipsideViewController class, I added the function that is
supposed to handle the action when the user clicks on a row:

 (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(
NSIndexPath *)indexPath {


if (dvController == nil) {

DetailViewController *aController = [[DetailViewController alloc]
initWithNibName:@"DetailView" bundle:nil];

self.dvController = aController; :

[aController release];

}

[self.navigationController pushViewController:dvController animatedYES];
}


When I run the application, nothing happens when the user clicks on the row
of a table view. Can someone tell me what I am missing here?

Thank you all,

aa
___

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


UI blocking

2010-05-16 Thread Tobias Jordan

Hey guys,

I have a CA transition running which obviously doesn't support any  
blocking modes (CABasicAnimation). I must block the UI during the  
transition so the user can't click somewhere and something unexpected  
happens. I think all animations in OS X are blocking the UI, for  
example minimizing a window going into the dock. Question, is there a  
way to block the UI / main thread or maybe just a window? I tried  
using usleep but looks like the animation and its drawing view don't  
like that. I can't believe there's no 'setBlockingMode' or something  
like that for CAAnimation.


Thanks in advance!

— Tobias___

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: add small (control size) column to table view

2010-05-16 Thread Scott Ribe
On May 14, 2010, at 5:35 PM, Scott Ribe wrote:

> I'm dynamically setting up columns in a table view, and I cannot get them set 
> up to display as NSSmallControlsSize. I try:
> 
>   [[col dataCell] setControlSize: NSSmallControlSize];
> 
> Immediately before and immediately after [resultsTbl addTableColumn:...], but 
> it doesn't affect the text size. The table cells draw as regular size.


Turns out setControlSize just doesn't do what I expected on the text cell. Use 
of setFont is required instead.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: drawing into a hidden view

2010-05-16 Thread Seth Willits
On May 15, 2010, at 11:50 AM, Shane wrote:

> I have an application which swaps NSViews based on which segment of an
> NSSegmentedControl the user clicks on. There's one specific NSView in
> which I draw a graph using NSBezierPath's. This view is initialized
> once my application is started and always exists, it's just not always
> the currently selected view.
> 
> My problem is that, when this one specific NSView is not selected and
> the user runs a process, once the process completes the user selects
> the view and no updates are drawn into it. But if the NSView is
> currently selected, the view gets updates when data points are sent to
> it. Selected or not, I always send data points to it to be drawn.

No you don't. You need them to be drawn when the view becomes visible. Drawing 
out-of-sight views is a waste of time and energy. 

When a view is added to a window and will be visible, it is marked as needing 
to be display, and is drawn. So if by "swapping views" you mean it is added as 
a subview of another view made visible, and removed when not, then you should 
already be covered.

If by swapping you mean that you're simply switching selected tabs in a tab 
view and this graphing view is one of those tabs, then you're also taken care 
of. When a view's visible frame changes, it redraws.

So the only way I can think of that this is happening, is that your data set 
isn't being set, and the view is still drawing the old content. That or 
something is calling setNeedsDisplay:NO.

There's not really enough information here to go on.



--
Seth Willits



___

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


swipe gestures

2010-05-16 Thread Jeremy Matthews
So I'm working them into my app, and I noticed that I can't seem to use them in 
order to select a tabviewitem, but I can appear to do other things (logging, 
alerts, etc)?
I checked my IBOutlets and everything is kosher there...

Is there a limitation here I am unaware of?
I can use tabviewitem selection anywhere else...

- (void)swipeWithEvent:(NSEvent *)event 
{
NSString *direction = nil;
if ([event deltaX] != 0) {
if ([event deltaX] > 0) {
direction = [[NSString alloc] initWithString:@"Left"];
NSLog(@"it is left");
NSAlert *theAlert = [[[NSAlert alloc] init] 
autorelease];
[theAlert addButtonWithTitle:@"OK"];
[theAlert setMessageText:@"Swiped!"];
[theAlert setInformativeText:@"To the left"];
[theAlert setAlertStyle:0];
int rCode = [theAlert runModal];
if (rCode == NSAlertFirstButtonReturn) {
//NSLog(@"Chosen");
[myTabView selectTabViewItem:tabViewItem1];
return;
} else if (rCode == NSAlertSecondButtonReturn) {
//NSLog(@"Override chosen - user not selecting 
account - mail could be interesting...");
} else {
//NSLog(@"other");
}
}
else {
direction = [[NSString alloc] initWithString:@"Right"];
NSLog(@"it is right");
NSAlert *theAlert = [[[NSAlert alloc] init] 
autorelease];
[theAlert addButtonWithTitle:@"OK"];
[theAlert setMessageText:@"Swiped!"];
[theAlert setInformativeText:@"To the right"];
[theAlert setAlertStyle:0];
int rCode = [theAlert runModal];
if (rCode == NSAlertFirstButtonReturn) {
//NSLog(@"Chosen");
[myTabView selectTabViewItem:tabViewItem1];
return;
} else if (rCode == NSAlertSecondButtonReturn) {
//NSLog(@"Override chosen - user not selecting 
account - mail could be interesting...");
} else {
//NSLog(@"other");
}   
}
}
else if ([event deltaY] != 0) {
if ([event deltaY] > 0) {
direction = [[NSString alloc] initWithString:@"Up"];
NSLog(@"it is up");
}
else
{
direction = [[NSString alloc] initWithString:@"Down"];
NSLog(@"it is down");

}
}

NSLog(@"Swipe gesture detected. Direction: %@", direction);

if (direction) {
[direction release];
}
}   

___

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: newbe view question

2010-05-16 Thread Markus Spoettl
On May 16, 2010, at 9:19 AM, ronald b. kopelman wrote:
>   I am designing a small app that will accept a dropped folder, get its 
> name & process it. Everything works fine. I can drop a folder on the dock 
> icon or the app icon & get exactly what I want. I would like to drop the 
> folder onto the app window while the app is running & get the same result but 
> I can't figure out how to drop the folder onto the window. I had thought 
> about subclassing the window's content view but, yuch, there must be a better 
> way. I have perused the literature & if something is there I have missed it. 
> Is there some way I can drop a folder onto a window or its content view & get 
> the name of the folder? Please point me in the right direction.

[forgot to copy the list]

The process is the same for window or view, basically just need to implement 
the NSDraggingDestination protocol and register the dragging types your 
interested in. The advantage of adding dragging support to the window is that 
you can drop your folder onto anything inside the window.

The drag and drop guide is very good, start here:



File dragging got its own chapter:



Regards
Markus
--
__
Markus Spoettl

___

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: Figuring out what's causing redrawing

2010-05-16 Thread Scott Andrew
Just a simple question. Do you have overlapping views going on? If you are 
overlapping a sibling that is being told to redraw, you will get  redraw every 
time the sibling redraws..

Scott

On May 13, 2010, at 12:52 PM, Nick Zitzmann wrote:

> I've tried searching around but haven't found an answer to this. I have 
> several views that are being constantly & apparently needlessly redrawn and I 
> can't figure out why this is happening. How do I catch the culprit that is 
> causing the views to be redrawn? The redrawing is appearing in the usual 
> place, within a call to -[NSWindow displayIfNeeded] in the run loop.
> 
> I already tried the following:
> 
> 1. Breaking on -[NSView setNeedsDisplayInRect:], but -drawRect: kept being 
> called anyway, so whatever is causing this is circumventing this method.
> 
> 2. Observing the value of -[NSView needsDisplay], but the value never 
> changes, and it keeps getting redisplayed anyway. Apparently the value is a 
> perpetual YES...
> 
> Nick Zitzmann
> 
> 
> ___
> 
> 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/scottandrew%40roadrunner.com
> 
> This email sent to scottand...@roadrunner.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: Why I can't see my localized nib?

2010-05-16 Thread Henry McGilton

On May 16, 2010, at 4:06 AM, Gustavo Pizano wrote:

> 
> 
> Hello all.
> 
> I was taking a look into  localization,  I check the docs at apple, and my 
> Cocoa book, and I did as they said.. First I right clicked a nib file, and 
> made it localizable, then add the French lang from the list. (this was a try 
> out)
> 
> Ok now I have 2 copies of the nib file one for english and one for French.  I 
> created the strings file form the english xib using ibtool,  the file was 
> generated ok.  I translated them and ran ibtool again to write the strings 
> into the French xib, all ok, I opened the french xib and there it was 
> localized.
> 
> I change my system language for french,  compile the project and ran,.. but I 
> still see the English xib, 
> 
> what am I doing wrong?
> 
> I followed another tutorial I found here 
> http://balthamos.blogspot.com/2008/05/introduction-so-you-are-probably-here_01.html
>  and I got the same results. ...


A long shot here, Gustavo.Did you Clean All Targets and then do a complete 
re-build?
If not, try that as a first step.

Best WIshes,
. . . . . . . .Henry

___

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: newbe view question

2010-05-16 Thread Scott Thompson
>> I had thought about subclassing the window's content view but, yuch, there 
>> must be a better way. I have perused the literature & if something is there 
>> I have missed it. Is there some way I can drop a folder onto a window or its 
>> content view & get the name of the folder? Please point me in the right 
>> direction.

Instead of trying to subclass and replace the content view, just create your 
own NSView subclass and add it as a subview of the content view that already 
exists.
___

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: newbe view question

2010-05-16 Thread Keary Suska
On May 16, 2010, at 7:19 AM, ronald b. kopelman wrote:

>   I am designing a small app that will accept a dropped folder, get its 
> name & process it. Everything works fine. I can drop a folder on the dock 
> icon or the app icon & get exactly what I want. I would like to drop the 
> folder onto the app window while the app is running & get the same result but 
> I can't figure out how to drop the folder onto the window. I had thought 
> about subclassing the window's content view but, yuch, there must be a better 
> way. I have perused the literature & if something is there I have missed it. 
> Is there some way I can drop a folder onto a window or its content view & get 
> the name of the folder? Please point me in the right direction.

NSWindow supports drag and drop, but AFAIK you will have to subclass to handle 
the drop. Pick your poison (subclass NSView for content view or subclass 
NSWindow)...

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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: Framework linking errors

2010-05-16 Thread Keary Suska
On May 15, 2010, at 10:00 PM, Patrick Rutkowski wrote:

> I should mention that the obvious suggestion of "You need to link your 
> framework against OpenSSL" is not what I'm looking for.

Well, are you specifying -lssl and -lcrypto in other linker flags? If not, you 
must.

> If I link my framework statically against OpenSSL, then I force the clients 
> of my framework to use that static version of OpenSSL, which I don't want.

Well, yes that would be the case except that Xcode will not link statically. 
Even if you want it to, in many cases.

> If I link my framework dynamically against OpenSSL, then I force the clients 
> of my framework to use the dynamic version of OpenSSL, which I also don't 
> want.

This is the default when you link against any library or framework.

> On May 15, 2010, at 11:29 PM, Patrick Rutkowski wrote:
> 
>> I'm building a Framework which internally uses OpenSSL, and exposes a sort 
>> of OpenSSL wrapper for various small purposes.
>> 
>> However, when linking the framework, Xcode complains of missing symbols like:
>> 
>> _ERR_error_string_n
>> _ERR_clear_error
>> _SSL_CTX_free
>> _SSL_CTX_new
>> _ERR_get_error
>> _SSL_library_init
>> _SSL_load_error_strings
>> 
>> I'm puzzled about this, since my previous experience with dynamic libraries 
>> has been with libtool projects via autotools, which such things never 
>> happened.
>> 
>> It turns out that libtool+autotools projects pass "-undefined 
>> dynamic_lookup" to the linker, which leaves such undefined symbols to be 
>> resolved by the client project. Which I assume it can resolve either by 
>> statically linking to the ssl, or by dynamically linking to the ssl library.
>> 
>> Is there any reason to NOT pass "-undefined dynamic_lookup" to the linker 
>> for a framework project? I'm awfully tempted to do so.


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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


newbe view question

2010-05-16 Thread ronald b. kopelman
I am designing a small app that will accept a dropped folder, get its 
name & process it. Everything works fine. I can drop a folder on the dock icon 
or the app icon & get exactly what I want. I would like to drop the folder onto 
the app window while the app is running & get the same result but I can't 
figure out how to drop the folder onto the window. I had thought about 
subclassing the window's content view but, yuch, there must be a better way. I 
have perused the literature & if something is there I have missed it. Is there 
some way I can drop a folder onto a window or its content view & get the name 
of the folder? Please point me in the right direction.

ronald b. kopelman___

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


Why I can't see my localized nib?

2010-05-16 Thread Gustavo Pizano


Hello all.

I was taking a look into  localization,  I check the docs at apple, and my 
Cocoa book, and I did as they said.. First I right clicked a nib file, and made 
it localizable, then add the French lang from the list. (this was a try out)

Ok now I have 2 copies of the nib file one for english and one for French.  I 
created the strings file form the english xib using ibtool,  the file was 
generated ok.  I translated them and ran ibtool again to write the strings into 
the French xib, all ok, I opened the french xib and there it was localized.

I change my system language for french,  compile the project and ran,.. but I 
still see the English xib, 

what am I doing wrong?

I followed another tutorial I found here 
http://balthamos.blogspot.com/2008/05/introduction-so-you-are-probably-here_01.html
 and I got the same results. ...


:S

thanks in advance.

Gustavo





___

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: drawing border of NSPopUpButtonCell drawInteriorWithFrame:inView:

2010-05-16 Thread Seth Willits
On May 15, 2010, at 7:17 PM, Shane wrote:

> This is a data table header cell of type NSPopUpButtonCell where I'm
> trying to draw the bottom border of the cell.
> 
> The problem is that the border along the bottom of each
> NSPopUpButtonCell only extends across part of the cell, not the entire
> length of the cell.
> 
> The docs say about the cellFrame "The bounding rectangle of the
> receiver, or a portion of the bounding rectangle". And I'm certainly
> only seeing a portion of the cells frame being drawn.
> 
> 
> Am I doing this wrong?

Well I don't know what you're seeing exactly, but the cells in a table view are 
spaced out.

- (void)setIntercellSpacing:(NSSize)aSize

The default intercell spacing is (3.0, 2.0).


--
Seth Willits



___

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