Re: Storyboard SplitViewController example

2011-12-25 Thread Steve Christensen
On Dec 24, 2011, at 7:13 PM, Jamie Daniel wrote:

> I am very new to Xcode and iPad development. I am trying to do the following:
> 
> I have an initial NavigationController and ViewController. I am trying to go 
> from a button on the ViewController to a SplitViewController using 
> Storyboards but I can't seem to get it to work. Does anyone have an example 
> of how to do it? Or an example of how to hand code it?

The iPad-Specific Controllers section of the View Controller Programming Guide 
for iOS specifically says:

"A split view controller must always be the root of any interface you create. 
In other words, you must always install the view from a UISplitViewController 
object as the root view of your application’s window. The panes of your 
split-view interface may then contain navigation controllers, tab bar 
controllers, or any other type of view controller you need to implement your 
interface."

This topic has come up here in the past, so you may want to search the archives.

Also, you cross-posted to the Xcode mailing list. This would be off-topic there 
so I removed it in this reply.

___

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: Storyboard SplitViewController example

2011-12-25 Thread Matt Neuburg

On Dec 25, 2011, at 12:00 PM, cocoa-dev-requ...@lists.apple.com wrote:

> I am very new to Xcode and iPad development. I am trying to do the following:
> 
> I have an initial NavigationController and ViewController. I am trying to go 
> from a button on the ViewController to a SplitViewController using 
> Storyboards but I can't seem to get it to work. Does anyone have an example 
> of how to do it? Or an example of how to hand code it?

First of all you need speak accurately. There is no such thing as a 
NavigationController or a ViewController, and if you mean UIViewController 
there's no such as a button on one since a UIViewController is not a UIView. 
And then "go from" doesn't mean much either. Do you mean you want to draw a 
connection? Or that you'd like the user to be able to tap the button and cause 
a split view to appear?

I'd avoid storyboards if I were you; they actually just make your life more 
complicated. And I'd avoid UISplitViewController! They are poorly written and 
rather inflexible. On iOS 5 if you want to split the view into two, you can 
easily do better than UISplitViewController, because you're now allowed to 
write your own container / parent view controllers. Here's an example modeled 
after the iOS 5 iPad Mail app:



m.___

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


How to update preview in NSPrintPanel?

2011-12-25 Thread Luc Van Bogaert
Hi,

I'm adding a custom user setting to a NSPrintPanel by adding an "accessory view 
controller" for a view that contains just one control (a checkbox) and which is 
loaded from a nib file. The checkbox's value has a binding to the view 
controller's "representedObject.printSettings.checkboxvalue" keypath. (The 
representedObject is a NSPrintInfo object).

I have been able to verify that this binding works correctly.

One thing I haven't gotten to work yet, is to automatically update the 
"preview" in the print panel when I chance the state of the checkbox. The 
preview updates itself correctly when I change one of the "built-in" settings, 
and it even correctly represents my own custom setting. But, how can I trigger 
an automatic update when I just change my own custom setting? 

I assume I should implement the  "keyPathsForValuesAffectingPreview" protocol 
method in my accessory view controller, which I did, but so far without 
success. Here's my implementation:

- (NSSet *)keyPathsForValuesAffectingPreview
{
return [NSSet setWithObjects:
[NSString 
stringWithFormat:@"representedObject.printSettings.checkboxvalue"],
nil];
}

Any help much appreciated.

-- 
Luc Van Bogaert




___

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 update preview in NSPrintPanel?

2011-12-25 Thread Graham Cox

On 26/12/2011, at 9:05 AM, Luc Van Bogaert wrote:

> Hi,
> 
> I'm adding a custom user setting to a NSPrintPanel by adding an "accessory 
> view controller" for a view that contains just one control (a checkbox) and 
> which is loaded from a nib file. The checkbox's value has a binding to the 
> view controller's "representedObject.printSettings.checkboxvalue" keypath. 
> (The representedObject is a NSPrintInfo object).
> 
> I have been able to verify that this binding works correctly.
> 
> One thing I haven't gotten to work yet, is to automatically update the 
> "preview" in the print panel when I chance the state of the checkbox. The 
> preview updates itself correctly when I change one of the "built-in" 
> settings, and it even correctly represents my own custom setting. But, how 
> can I trigger an automatic update when I just change my own custom setting? 
> 
> I assume I should implement the  "keyPathsForValuesAffectingPreview" protocol 
> method in my accessory view controller, which I did, but so far without 
> success. Here's my implementation:
> 
> - (NSSet *)keyPathsForValuesAffectingPreview
> {
>return [NSSet setWithObjects:
>[NSString 
> stringWithFormat:@"representedObject.printSettings.checkboxvalue"],
>nil];
> }
> 
> Any help much appreciated.
> 
> -- 
> Luc Van Bogaert


Well, I have added a print accessory view, but I'm not using bindings.

My accessory view controller implements this:

- (NSSet *) keyPathsForValuesAffectingPreview
{
return [NSSet setWithObjects:@"fitToSinglePage", @"cropMarks", 
@"printsGraphPaper", nil];
}


where the strings here are the names of properties implemented by the 
controller. I don't know how that translates to bindings, or on what object. 
It's a long time since I wrote this code, I forget much of the thought process 
that went into it, but it works reliably and I've never needed to look at it 
again. The controller makes changes to the NSPrintOperation object which it 
holds as a property.

Probably not much help, but you're on the right track, so persevere…..

--Graham


___

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

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

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

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


Re: Storyboard SplitViewController example

2011-12-25 Thread Roland King

On Dec 26, 2011, at 4:18 AM, Matt Neuburg wrote:

> 
> I'd avoid storyboards if I were you; they actually just make your life more 
> complicated. And I'd avoid UISplitViewController! They are poorly written and 
> rather inflexible. On iOS 5 if you want to split the view into two, you can 
> easily do better than UISplitViewController, because you're now allowed to 
> write your own container / parent view controllers. Here's an example modeled 
> after the iOS 5 iPad Mail app:
> 
> 

I'll put one vote in defence of StoryBoards. I agree with many of the things 
you and Kyle have written about them recently, they don't feel finished and 
have some bugs, can be challenging to use on a small screen, may not be 
appropriate for large projects with many screens and the documentation is thin. 
But I do like the concept behind them and for simple apps they've allowed me to 
quickly hook up a framework for my concept, make sure the flow works properly, 
adjust it until it does, and then flesh it out. Perhaps if you're a good UI 
designer you can do that on a piece of paper, I am not a good UI designer at 
all and like to have a way to mock up the interface. I think also they fit 
nicely with iOS 5.0's improvements in UIViewController (especially containment 
which I think should have been there at the start) and are worth a look. I'm 
assuming Apple will continue to refine them and I keep filing bugs against them 
when I see them. 

Pet peeves of mine include the general bugginess (often making some kind of 
edit will cause all the view controllers and segues to disappear, requiring you 
to click on the list at the side to make them reappear, filed that one), my 
view that custom segues are only half thought-out and only half implemented, 
they should be called in both directions so the cute custom animation you write 
to put something on the screen can take it off again and the monolithic 
storyboard file is corruption waiting to happen in any shared project.  But I 
don't hate them and I have found a place for them in my workflow. 

___

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 update preview in NSPrintPanel?

2011-12-25 Thread Quincey Morris
On Dec 25, 2011, at 14:05 , Luc Van Bogaert wrote:

> I'm adding a custom user setting to a NSPrintPanel by adding an "accessory 
> view controller" for a view that contains just one control (a checkbox) and 
> which is loaded from a nib file. The checkbox's value has a binding to the 
> view controller's "representedObject.printSettings.checkboxvalue" keypath. 
> (The representedObject is a NSPrintInfo object).
> 
> I have been able to verify that this binding works correctly.
> 
> One thing I haven't gotten to work yet, is to automatically update the 
> "preview" in the print panel when I chance the state of the checkbox. The 
> preview updates itself correctly when I change one of the "built-in" 
> settings, and it even correctly represents my own custom setting. But, how 
> can I trigger an automatic update when I just change my own custom setting? 
> 
> I assume I should implement the  "keyPathsForValuesAffectingPreview" protocol 
> method in my accessory view controller, which I did, but so far without 
> success. Here's my implementation:
> 
> - (NSSet *)keyPathsForValuesAffectingPreview
> {
>return [NSSet setWithObjects:
>[NSString 
> stringWithFormat:@"representedObject.printSettings.checkboxvalue"],
>nil];
> }

The immediate problem is that binding through a mutable dictionary like this 
(printSettings) isn't KVO compliant. Properties with values that are mutable 
objects are generally a problem for KVC/KVO, since it's really designed around 
the idea that property values are immutable objects like NSString and NSNumber.

The secondary problem is that you're trying, simultaneously, to use 2 different 
ways to get the accessory panel to update automatically, and both ways aren't 
working. If your binding was working, then 'keyPathsForValuesAffectingPreview' 
wouldn't be necessary. If you had a working 
'keyPathsForValuesAffectingPreview', then I suspect you'd find that the 
checkbox still wouldn't change -- not because it wasn't updating, but because 
the change wouldn't be propagated.

I think the simplest approach is to add a "checkboxvalue" property to the view 
controller, bind the checkbox to File's Owner.checkboxvalue, and then make this 
property KVO-compliant:

1. The getter can just return 
self.representedObject.printSettings.checkboxvalue.

2. The setter can just change 
self.representedObject.printSettings.checkboxvalue.

3. The view controller needs to keep track of the current print settings object 
by observing its own "representedObject.printSettings" keypath.

4. Whenever the print settings object changes, the view controller needs to 
observe the "checkboxvalue" key of the new object and stop observing the same 
key of the old object.

5. Whenever the observed "checkboxvalue" changes, transfer the new value to 
self.checkboxvalue. Note that this starts a messaging loop between the 2 
"checkboxvalue" properties, but the KVO machinery prevents this from being an 
infinite loop. You can short circuit the remaining minor duplication of effort, 
if you wish, by having your setter check the dictionary property value to avoid 
re-setting it to the existing value.


___

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


CoreData inconsistency caching error snafu

2011-12-25 Thread Alexander Reichstadt
Hi,

On Xcode 4.2 I am getting some error that makes no sense to me and all similar 
reports on the web don't seem to apply:


CoreData: FATAL ERROR: The persistent cache of section information does not 
match the current configuration.  You have illegally mutated the 
NSFetchedResultsController's fetch request, its predicate, or its sort 
descriptor without either disabling caching or using +deleteCacheWithName:


After I reset the simulator device it works once, I quit the app, launch it and 
get the same message. The first launch I did make a fetch, it downloads some 
data and puts them into the sqlite core data store, then I call

[self saveContext];

If I don't call saveContext, my data is not saved, and next launch it needs to 
download it all over again. If I do save I get aforementioned message.

At the end of the message which also lists all objects in core data, it states:

 *** Terminating app due to uncaught exception 
'NSInternalInconsistencyException', reason: 'CoreData: FATAL ERROR: The 
persistent cache of section information does not match the current 
configuration.  You have illegally mutated the NSFetchedResultsController's 
fetch request, its predicate, or its sort descriptor without either disabling 
caching or using +deleteCacheWithName:'

When looking at the documentation on deleteCacheWithName, things make even less 
sense to me, because I never cached anything.

Please, could someone help?

Thanks
Alex

___

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: CoreData inconsistency caching error snafu

2011-12-25 Thread Alexander Reichstadt
Never mind…..I didn't know I need to look after the 
NSFetchedResultsController……..actually I am not sure what'd be the best to do. 
I toy around and see what works best.

On 26.12.2011, at 02:46, Alexander Reichstadt wrote:

> Hi,
> 
> On Xcode 4.2 I am getting some error that makes no sense to me and all 
> similar reports on the web don't seem to apply:
> 
> 
> CoreData: FATAL ERROR: The persistent cache of section information does not 
> match the current configuration.  You have illegally mutated the 
> NSFetchedResultsController's fetch request, its predicate, or its sort 
> descriptor without either disabling caching or using +deleteCacheWithName:
> 
> 
> After I reset the simulator device it works once, I quit the app, launch it 
> and get the same message. The first launch I did make a fetch, it downloads 
> some data and puts them into the sqlite core data store, then I call
> 
>[self saveContext];
> 
> If I don't call saveContext, my data is not saved, and next launch it needs 
> to download it all over again. If I do save I get aforementioned message.
> 
> At the end of the message which also lists all objects in core data, it 
> states:
> 
> *** Terminating app due to uncaught exception 
> 'NSInternalInconsistencyException', reason: 'CoreData: FATAL ERROR: The 
> persistent cache of section information does not match the current 
> configuration.  You have illegally mutated the NSFetchedResultsController's 
> fetch request, its predicate, or its sort descriptor without either disabling 
> caching or using +deleteCacheWithName:'
> 
> When looking at the documentation on deleteCacheWithName, things make even 
> less sense to me, because I never cached anything.
> 
> Please, could someone help?
> 
> Thanks
> Alex
> 
> ___
> 
> 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/lxr%40mac.com
> 
> This email sent to l...@mac.com

___

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

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

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

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


Text system glitch - lines across text view

2011-12-25 Thread Andrew Hughes
Hello all and merry christmas,

I have a text editor program that I wrote and on the whole it works very
well, but I've struggled on and off with a recurring annoying issues. Lines
are drawn across the NSTextView below where I am writing. Sometimes the
text also appears "doubled"; it looks darker and slightly larger.

http://www.cantgetnosleep.com/glitch_lines.png

This problem only seems to happen when I am in the paginated view, so it's
likely some issue in my pagination algorithm. I'm guessing it's a matter of
either calling or not calling one of the various display-refresh-related
methods but I'm not sure.

Some more background: the text system allows the user to view multiple
NSTextStorage-NSTextContainer-NSTextView systems in a single master view by
laying them out on the screen in pages. So that on a single screen you will
have a heirarchy like:


 NSTextView > NSTextContainer
 NSTextView > NSTextContainer > NSTextStorage
 NSTextView > NSTextContainer

NSView ->  NSTextView > NSTextContainer
 NSTextView > NSTextContainer > NSTextStorage

NSTextView > NSTextContainer
NSTextView > NSTextContainer > NSTextStorage
NSTextView > NSTextContainer
NSTextView > NSTextContainer
NSTextView > NSTextContainer

The list of visible NSTextViews needed can get quite large, so as an
optimization the pagination algorithm starts at the currently being edited
NSTextStorage-Container-View and does that in the foreground before laying
out the rest of the system on a separate thread in the background (they are
hidden while being pushed to a separate thread).

The bug/issue typically occurs when I start hitting "return", which causes
the pagination algorithm and layout system to kick in, leaving behind the
lines and bold-looking text. It always clears if I scroll or click the
mouse over it or highlight that area.

Many thanks! Hopefully somebody can help me figure this out.

Andrew
___

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