UIControllerView demo

2011-12-27 Thread Brian Bruinewoud
Hi,

In the WDC 2011 Session 102 on UIControllerView containment, Bruce Nilo implies 
that the code in the demo will be available. Does anyone know where this is? He 
doesn't mention the name of the app, I can't find anything that looks right on 
developer.apple.com and the quick help in XCode doesn't mention any sample code 
for the new API.

Failing that - any other good example code?

Thanks,
Brian.


___

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


UIScrollView zooming a rotated view

2011-06-23 Thread Brian Bruinewoud
Hi All,

I have a UIScrollView that contains a single UIView.
I have a couple of buttons in the toolbar that let me rotate the UIView in 90 
degree increments.

When the rotation is 0, zooming via the pinch mechanism works fine.
When the rotation is 90 or 270, zooming via pinch does nothing.
When the rotation is 180, zooming via the pinch works 'backwards', that is, 
what should expand the image, shrinks it and vice versa.

I've logged the values of the UIView's transform and I guess the issue is that 
UIScrollView directly manipulates A and D in this matrix.

For rotation = 0, A and B are both 1.
For rotation = 90 or 270, A and B are both 0 - hence nothing changes as 0 * x = 
0.
For rotation = 180, A and B are both -1. Not sure how this results in 
'backwards' pinches, though.

Is there something I need to do to get the ScrollView to work? Or is it a bug?

I thought I have seen apps where you can zoom and rotate with a single gesture- 
where those views hand coded?

Thanks,
Brian.___

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: layoutSubviews doesn't always work (iOS 4.3 on iPad Simulator)

2011-06-18 Thread Brian Bruinewoud
Matt,

Thanks for your response.

Actually, that didn't work for me but it did lead me to find a solution.

In my case, the scroll view's contentSize wasn't being updated correctly.
To fix it I wrote the following (translated to your names) in layoutSubviews:

sv.contentSize = v.bounds.size;

As to why its not being update correctly, I don't know. But this did fix two 
other issues I was having (and, assuming the issue is in your code too) you 
should be having- namely, when I zoomed big, the scroll view sometimes wouldn't 
let me scroll to the portions of the content that were off screen.

Could you check in your code to see if its the same issue - at least that will 
suggest some kind of bug in the frameworks/documentation rather than my code :)

Thanks,
Brian.

On 19/06/2011, at 02:05 , Matt Neuburg wrote:

 On Sun, 12 Jun 2011 14:30:42 +1000, Brian Bruinewoud br...@darknova.com 
 said:
 Hi All,
 
 I have an app that consists of a scroll view subclass which contains a 
 single subview. In the scroll view subclass I override layoutSubviews based 
 on Apple sample code (see below). The intention of layoutSubviews is to 
 centre the subview in the scrollview when the subview is smaller than the 
 scrollview's display area.
 
 There are three circumstances where the layoutSubviews is called but in one 
 of them the visual results are incorrect.
 
 Funny you should mention this, since I was just experimenting with the same 
 issue. What I ended up doing is setting the contentOffset explicitly after 
 the zoomScale changes. 
 
 https://github.com/mattneub/Programming-iOS-4-Book-Examples/tree/master/p492zoomCentered
 
 m.
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 A fool + a tool + an autorelease pool = cool!
 Programming iOS 4!
 http://www.apeth.net/matt/default.html#iosbook

___

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: layoutSubviews doesn't always work (iOS 4.3 on iPad Simulator)

2011-06-18 Thread Brian Bruinewoud
Hi Matt,

My code is based on Apple's sample ZoomingPDFViewer which actually replaces 
the content view after each zoom so that the contents can be drawn crisply 
rather than blurily scaled. So, this would be an issue in their code, then, but 
they only have pinching for rescaling, not zoom-to gestures. Or, perhaps, I 
copied the code incompletely - I'll re-check. Either way, it seems from your 
comment that I should then be able to move the code snippet below to the 
location where the view is replaced.

Further, I'm no longer sure that I need to do the view swapping that Apple's 
code did - I could probably get away with resizing the original view directly. 
I'll try that later.

As for scrolling when zoomed large - this issue only happened occasionally but 
it seems to be gone now.

Anyway, now that we're both happy, I wonder why you need the setContentOffset 
code while I (it seems so far) do not.

Regards,
Brian.

On 19/06/2011, at 13:24 , Matt Neuburg wrote:

 
 On Jun 18, 2011, at 6:50 PM, Brian Bruinewoud wrote:
 
 Actually, that didn't work for me but it did lead me to find a solution.
 
 Cool!
 
 
 In my case, the scroll view's contentSize wasn't being updated correctly.
 To fix it I wrote the following (translated to your names) in layoutSubviews:
 
  sv.contentSize = v.bounds.size;
 
 
 Hmm. Not sure why that should be necessary. The contentSize should not *need* 
 any updating; you should set it once at the outset, and then when you zoom, 
 the zoomable view is transformed and everything just follows as a matter of 
 course. The scroll view compensates in accordance with the transform, 
 automatically. I don't quite get why you're needing to do this.
 
 
 As to why its not being update correctly, I don't know. But this did fix two 
 other issues I was having (and, assuming the issue is in your code too) you 
 should be having- namely, when I zoomed big, the scroll view sometimes 
 wouldn't let me scroll to the portions of the content that were off screen.
 Could you check in your code to see if its the same issue
 
 Well, no, clearly not. If you download and run the project I pointed you to, 
 you'll see there's no problem about scrolling to the offscreen portions of 
 the image when it's zoomed large. m.
 
 
 
 
 On 19/06/2011, at 02:05 , Matt Neuburg wrote:
 
 On Sun, 12 Jun 2011 14:30:42 +1000, Brian Bruinewoud br...@darknova.com 
 said:
 Hi All,
 
 I have an app that consists of a scroll view subclass which contains a 
 single subview. In the scroll view subclass I override layoutSubviews 
 based on Apple sample code (see below). The intention of layoutSubviews is 
 to centre the subview in the scrollview when the subview is smaller than 
 the scrollview's display area.
 
 There are three circumstances where the layoutSubviews is called but in 
 one of them the visual results are incorrect.
 
 Funny you should mention this, since I was just experimenting with the same 
 issue. What I ended up doing is setting the contentOffset explicitly after 
 the zoomScale changes. 
 
 https://github.com/mattneub/Programming-iOS-4-Book-Examples/tree/master/p492zoomCentered
 
 m.
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
 Programming iOS 4! http://www.apeth.net/matt/default.html#iosbook
 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


layoutSubviews doesn't always work (iOS 4.3 on iPad Simulator)

2011-06-11 Thread Brian Bruinewoud
Hi All,

I have an app that consists of a scroll view subclass which contains a single 
subview. In the scroll view subclass I override layoutSubviews based on Apple 
sample code (see below). The intention of layoutSubviews is to centre the 
subview in the scrollview when the subview is smaller than the scrollview's 
display area.

There are three circumstances where the layoutSubviews is called but in one of 
them the visual results are incorrect.

If I pinch to zoom, the layout looks correct. 
scrollViewDidEndZooming:withView:forScaleL contains a single line of code that 
calls rescaleTo:animated:
[ rescaleTo: myScale * scale animated: NO ];

If I change the frame of the subview, the layout looks correct.
This is called automatically by the framework because I have called 
setNeedsLayout when I resized the subview.

If I attempt to reset the zoom to scale = 1, the layout is not centred if the 
view was bigger than the display area prior to attempting the rescale.
This is done by calling rescaleTo:animated: directly.
[ rescaleTo: 1.0 animated: YES ];

The animated: parameter only affects the contents of the subview and setting it 
to NO for all calls to this method doesn't change the results.

When I trace through layoutSubviews, the input (self.bounds.size and 
myCurrentView.frame) and output (frameToCentre) values are the same in all 
three cases, but only in the third does it not centre properly. Note that the 
subview does change position, though. 


Here is the code for layoutSubviews:

- (void)layoutSubviews 
{
[super layoutSubviews];

// center the image as it becomes smaller than the size of the screen

CGSize boundsSize = self.bounds.size;  // 1024 x 704
CGRect frameToCenter = myCurrentView.frame;  // 240 x 100 @ ( 0, 0 )

// center horizontally
if( frameToCenter.size.width  boundsSize.width )
frameToCenter.origin.x = ( boundsSize.width - frameToCenter.size.width  
 ) / 2;
else
frameToCenter.origin.x = 0;

// center vertically
if( frameToCenter.size.height  boundsSize.height )
frameToCenter.origin.y = ( boundsSize.height - 
frameToCenter.size.height ) / 2;
else
frameToCenter.origin.y = 0;

myCurrentView.frame = frameToCenter; // 240 x 100 @ ( 392, 302 )
}

Any ideas where I should look or what might be causing the behaviour?

Thanks,
Brian.___

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


An architectural question for iOS app

2011-05-30 Thread Brian Bruinewoud
Hi all,

I'm about to start writing an app (Target is iPad running 4.3 or later) but 
I've gotten to a position where I'm not sure of the best way to proceed with 
the architecture. I thought I'd better ask now before I paint myself into a 
corner.

The parts of the app with which I am having trouble will be similar to a basic 
vector graphic or CAD program. The user will be able to add objects to the 
document/screen from a palette and then move these objects around and edit them 
in various ways. Most documents will have around 25 objects; 50 would be a 
large number. The objects will exist in a document level coordinate system 
which should be mapped to the view coordinate system. When the user does a 
pinch gesture, the objects will change in size but, at the end of the gesture, 
they should all be redrawn at the new size so that they look neat and so as to 
adjust the amount of details displayed within them. Finally, when the iPad is 
rotated I would like to keep graphical aspects of the document un-rotated but 
rotate the UI and any text on the document. 

So, given the above, I'm wondering how to represent the objects. Currently I 
just have them as subviews within the main view (which is a UIView within a 
UIScrollView) and I can drag them around (thanks to a gesture recogniser 
attached to each object's view) and I can pinch to zoom (thanks to the Scroll 
View). I haven't worked out how to do the level of detail stuff, though I read 
that CATiledLayer might be of assistance, but then I don't think that doesn't 
play well with the UIView-per-object architecture I currently have. The views 
seem to give me a fair bit of functionality - hit testing, animation, gesture 
recognition (of which I'll need more than the current drag around) - but I 
haven't worked out how to do the nice zoom-and-redraw stuff. 

Other issues I'm having (in the Simulator):

Sometimes the scrolling of the scrollview doesn't happen and then randomly 
starts happening. Sometimes it starts happening even though I haven't zoomed; 
Sometimes it doesn't even though I have zoomed. There are no gesture 
recognisers on the larger views that might be interfering and I'm not 
accidentally touching the object views.

I would have liked to use the transformation property of the main view to map 
the object view's coordinates to the UIViews coordinates. It seems like it 
should work but I've had no success with this and in my small proof-of-concept 
that I did I just resorted to direct manipulation of the coordinates.

I haven't started with the rotation thing yet so I don't know if that will 
confuse me.

Anyway, I would like comments/suggestions. Is the view-per-object approach 
reasonable and can you suggest solutions to my zooming-level-of-detail and 
other issues? Or should I do the whole thing in one view and do manual hit 
testing and dragging etc?

Thanks,
Brian.___

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: An architectural question for iOS app

2011-05-30 Thread Brian Bruinewoud
One Issue I'm having that I forgot to mention is that when I zoom in, the 
gesture recogniser on the objects ceases to recognise my attempts to drag and 
the scrollview drags instead - I have to zoom back out to near to 1:1 before I 
cant start dragging the objects again.

On 30/05/2011, at 21:55 , Brian Bruinewoud wrote:

 Hi all,
 
 I'm about to start writing an app (Target is iPad running 4.3 or later) but 
 I've gotten to a position where I'm not sure of the best way to proceed with 
 the architecture. I thought I'd better ask now before I paint myself into a 
 corner.
 
 The parts of the app with which I am having trouble will be similar to a 
 basic vector graphic or CAD program. The user will be able to add objects to 
 the document/screen from a palette and then move these objects around and 
 edit them in various ways. Most documents will have around 25 objects; 50 
 would be a large number. The objects will exist in a document level 
 coordinate system which should be mapped to the view coordinate system. When 
 the user does a pinch gesture, the objects will change in size but, at the 
 end of the gesture, they should all be redrawn at the new size so that they 
 look neat and so as to adjust the amount of details displayed within them. 
 Finally, when the iPad is rotated I would like to keep graphical aspects of 
 the document un-rotated but rotate the UI and any text on the document. 
 
 So, given the above, I'm wondering how to represent the objects. Currently I 
 just have them as subviews within the main view (which is a UIView within a 
 UIScrollView) and I can drag them around (thanks to a gesture recogniser 
 attached to each object's view) and I can pinch to zoom (thanks to the Scroll 
 View). I haven't worked out how to do the level of detail stuff, though I 
 read that CATiledLayer might be of assistance, but then I don't think that 
 doesn't play well with the UIView-per-object architecture I currently have. 
 The views seem to give me a fair bit of functionality - hit testing, 
 animation, gesture recognition (of which I'll need more than the current drag 
 around) - but I haven't worked out how to do the nice zoom-and-redraw stuff. 
 
 Other issues I'm having (in the Simulator):
 
 Sometimes the scrolling of the scrollview doesn't happen and then randomly 
 starts happening. Sometimes it starts happening even though I haven't zoomed; 
 Sometimes it doesn't even though I have zoomed. There are no gesture 
 recognisers on the larger views that might be interfering and I'm not 
 accidentally touching the object views.
 
 I would have liked to use the transformation property of the main view to map 
 the object view's coordinates to the UIViews coordinates. It seems like it 
 should work but I've had no success with this and in my small 
 proof-of-concept that I did I just resorted to direct manipulation of the 
 coordinates.
 
 I haven't started with the rotation thing yet so I don't know if that will 
 confuse me.
 
 Anyway, I would like comments/suggestions. Is the view-per-object approach 
 reasonable and can you suggest solutions to my zooming-level-of-detail and 
 other issues? Or should I do the whole thing in one view and do manual hit 
 testing and dragging etc?
 
 Thanks,
 Brian.___
 
 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/brian%40darknova.com
 
 This email sent to br...@darknova.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 NSClassFromString(@CADisplayLink)?

2011-05-11 Thread Brian Bruinewoud
Thanks for the various answers.

Hank said:
If the class is missing, NSClassFromString(@CADisplayLink) returns nil. When 
you say that it compiles and runs, does that mean that line of code puts a 
non-nil value in displayLink?

My Response:
The code functions only because displayLink is non-Nil. So NSClassFromString is 
returning something otherwise my display link delegate would never get called.

David said:
These types of link errors typically indicate that you forgot to link a 
necessary framework, in this case QuartzCore.framework

My Response:
Ok. But I'm using core animation in my app, which requires that framework 
anyway so I assume it would be included. If not, then why is anything running? 
Will it die when I try to run it on the real device (something I can't test at 
the moment)?

FYI:
This code was from the Apple Sample code - for an OpenGL iPhone app, I believe.

Thanks for your answers - I'll check the XCode project as soon as I'm able.

On 10/05/2011, at 20:34 , Brian Bruinewoud wrote:

 Hi All,
 
 Just curious, why does this work (compiles and runs):
 
displayLink = [NSClassFromString(@CADisplayLink) displayLinkWithTarget: 
 tapped selector:@selector(respond:)];
 
 But this doesn't link because the CADisplayLink class is missing:
 
displayLink = [CADisplayLink   displayLinkWithTarget: 
 tapped selector:@selector(respond:)];
 
 ??
 
 Link error is:
 
 Undefined symbols for architecture i386:
  _OBJC_CLASS_$_CADisplayLink, referenced from:
  objc-class-ref in drawingViewController.o
 ld: symbol(s) not found for architecture i386
 collect2: ld returned 1 exit status
 
 Using XCode 4.0 and the iPad simulator. I suppose if I compiled for ARM the 
 error might go away (but I don't have provisioning profile so I can't test 
 that). Still, the code still runs so it must be able to link at run time even 
 if it can't at compile time, which seems strange.
 
 Anyway, just curious.
 
 Regards,
 Brian.
 
 ___
 
 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/brian%40darknova.com
 
 This email sent to br...@darknova.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


Why NSClassFromString(@CADisplayLink)?

2011-05-10 Thread Brian Bruinewoud
Hi All,

Just curious, why does this work (compiles and runs):

displayLink = [NSClassFromString(@CADisplayLink) displayLinkWithTarget: 
tapped selector:@selector(respond:)];

But this doesn't link because the CADisplayLink class is missing:

displayLink = [CADisplayLink   displayLinkWithTarget: 
tapped selector:@selector(respond:)];

??

Link error is:

Undefined symbols for architecture i386:
  _OBJC_CLASS_$_CADisplayLink, referenced from:
  objc-class-ref in drawingViewController.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Using XCode 4.0 and the iPad simulator. I suppose if I compiled for ARM the 
error might go away (but I don't have provisioning profile so I can't test 
that). Still, the code still runs so it must be able to link at run time even 
if it can't at compile time, which seems strange.

Anyway, just curious.

Regards,
Brian.

___

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: block animation

2011-05-06 Thread Brian Bruinewoud
Thanks David, that's led me on the right path - I seem to have two instances of 
the view controller where there should be one so I'll need to check my NIB 
wiring, something wrong there.

On 06/05/2011, at 01:47 , David Duncan wrote:

 On May 4, 2011, at 4:50 AM, Brian Bruinewoud wrote:
 
 Question is: Why doesn't the Nothing button animate in all calls to the 
 method?
 
 
 Only thing I can think of is self.nothingButton == nil.
 --
 David Duncan
 

___

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: block animation

2011-05-04 Thread Brian Bruinewoud
Ignore my parallel issue with loading views - they are not affecting this.

I've now made a simple project which exhibits this animation issue.

I create a view based ipad app
Add a toolbar to the top
and add two buttons to the main view: Animate and Nothing
The button that comes with the toolbar pops up a popover
The popover contains a single button, Animate, and some space.
Both Animate buttons are connected to a method of the main view controller 
(see below).
When I touch the Animate in the main view, both the touched Animate button 
and the Nothing button are animated.
When I touch the Animate in the popover, only the touched Animate button is 
animated, not the Nothing button.

Question is: Why doesn't the Nothing button animate in all calls to the method?

- (IBAction) animateStuff: (id) sender
{
UIButton *b = (UIButton*)sender; // either one of the Animate buttons

[ UIView animateWithDuration: 0.25 
   delay: 0.01
 options: UIViewAnimationOptionCurveEaseIn
  animations: ^{
  // move the Animate button
  CGRect r = b.frame;
  r.origin.x = r.origin.x + 10;
  r.origin.y = r.origin.y +  5;
  b.frame = r;
  
  // resize the Nothing button
  r = self.nothingButton.frame;
  if( r.size.width == 400 )
  {
  r.size.width  = 100;
  r.size.height = 100;
  }
  else
  {
  r.size.width  = 400;
  r.size.height = 400;
  }
  self.nothingButton.frame = r;
  }
  completion: nil
 ];
}

Full project available on request (33Kb zip)

On 04/05/2011, at 01:53 , David Duncan wrote:

 On May 3, 2011, at 3:40 AM, Brian Bruinewoud wrote:
 
 Hi All,
 
 self.view.alpha is animated but nothing at all happens to drawingVC.view.
 
 
 My guess would be that 'drawingVC.view' isn't actually in a window anywhere.
 
 Given your current and previous question however, I would posit that you are 
 mis-using UIViewControllers and possibly causing various other issues for 
 yourself (that said, I don't know why you get the results you do in your 
 other question).
 
 I would highly recommend that you read the View Controller Programming Guide, 
 especially the section on view controller containment (spoiler alert: what 
 you are doing is not supported). If you want to be able to load arbitrary 
 views from nibs to add to a view managed by a view controller, the 
 recommendation is to use an NSObject subclass to own the view and UINib to 
 load the nib.
 --
 David Duncan
 

___

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


UIView not loading

2011-05-03 Thread Brian Bruinewoud
Hi All,

This has got me annoyingly stumped. 

What I'm trying to do:
In a popover, I have buttons
On touching a button, a subview will be created in the main view of the screen 
(that is, beneath the popover)

What's not happening:
The view isn't being instantiated
For debugging purposes, I've implemented the loadView method on the appropriate 
view controller to call super and log a message but the message never appears 
implying that loadVIew isn't being called.

Code where I try to create the view. This is the action behind the touch event.
  - (IBAction) addRoom: (id) sender;
  {
UIViewController *newRoom = [[ Room alloc ] initWithNibName: @Room 
bundle: nil ];
if( !newRoom )
NSLog(@Extra Huh?!);

NSBundle *b = newRoom.nibBundle;
NSString *n = newRoom.nibName;
BOOL  l = newRoom.isViewLoaded;

NSLog(@bundle:%@  nib:%@  loaded:%d, b, n, l );

UIView *nrV = newRoom.view;
if( !nrV )
NSLog(@Huh?);

newRoom.view.frame = CGRectMake( 0, 0, 100, 100 );
newRoom.view.alpha = 0;

[ self.view addSubview: newRoom.view ];

nrV = newRoom.view;
if( !nrV )
NSLog(@Still Huh?);
  }


Code in loadView.
  - (void) loadView
  {
[ super loadView ];
NSLog( @Room::loadView );
  }

The logging produced is this:
  2011-05-03 20:10:45.210 drawing[924:207] Room::initWithNibName: Room bundle: 
(null)
  2011-05-03 20:10:45.212 drawing[924:207] bundle:NSBundle 
/blah/blah/drawing.app (loaded)  nib:Room  loaded:0
  2011-05-03 20:10:45.213 drawing[924:207] Huh?
  2011-05-03 20:10:45.216 drawing[924:207] Still Huh?

Why isn't the view being created? What do I need to do to force it to be 
created?

Thanks,
Brian.___

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


block animation

2011-05-03 Thread Brian Bruinewoud
Hi All,

This animation doesn't code doesn't work properly:

  - (IBAction) gotClicked: (id) sender
  {
[UIView animateWithDuration: 1.0
  delay: 0.0
options: UIViewAnimationOptionCurveEaseIn
 animations:^{
 self.view.alpha = 0.0;
 drawingVC.view.alpha = 0.0;
 drawingVC.view.frame = CGRectMake(400, 400, 400, 400);
 }
 completion::nil];
  }

self.view.alpha is animated but nothing at all happens to drawingVC.view.

The documentation says that multiple views can be animated in the block and it 
doesn't say that there are any limitations as to where those views are so I'm 
not sure why it doesn't work. Both views are UIViews.

Having said that, I really have no mental model as to how these block based 
animations are implemented behind the scenes so I have no means of reasoning 
about these items. Can someone explain how animateWithDuration: is implemented 
in regards to the block? It doesn't have to be the actual implementation, just 
a reasonable one.

Thanks,
Brian.___

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: Value Bindings in IB - Where's the documentation?

2010-05-03 Thread Brian Bruinewoud
Thanks, Ken, the CocoaBindingsRef is what I was looking for - now I'll see if I 
can work it out from there before looking at the other links you sent :)

On 02/05/2010, at 20:27 , Ken Thomases wrote:

 On May 2, 2010, at 5:14 AM, Brian Bruinewoud wrote:
 
 I'm trying to find documentation about what the various bindings in IB 
 actually do. If I look at the documentation for NSArrayController (or any 
 controller) and NSPopUpButton (or any UI control) I don't find what I'm 
 looking for.
 
 http://developer.apple.com/mac/library/documentation/Cocoa/Reference/CocoaBindingsRef/CocoaBindingsRef.html
 
 I agree that there ought to be links from each class to the corresponding 
 page in that reference.
 
 
 I've run into similar questions to this before, but the particular 
 motivating example at moment is as follows. In a Table, I want a pop-up cell 
 for a given column. The columns in the table are all bound to an 
 NSArrayController which is in turn backed by CoreData. The list of possible 
 values for the column with the pop-up is also meant to be bound to another 
 NSArrayController which is also back by CoreData. I have not yet been able 
 to get this to work. 
 
 There's documentation for this sort of arrangement in the Cocoa Bindings 
 Programming Topics:
 
 http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaBindings/Tasks/onerelation.html
 
 Also, check here for more examples and discussion:
 
 http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
 
 Cheers,
 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


Value Bindings in IB - Where's the documentation?

2010-05-02 Thread Brian Bruinewoud
Hi All,

I'm trying to find documentation about what the various bindings in IB actually 
do. If I look at the documentation for NSArrayController (or any controller) 
and NSPopUpButton (or any UI control) I don't find what I'm looking for.

In general, where is there a description of the various bindings that apply to 
a control and/or controller? 
Specifically, what is the difference between the following bindings in the 
Value group?:
  * Content
  * Content Objects
  * Content Values
  * Selected Index
  * Selected Object
  * Selected Tag
  * Selected Value

I've run into similar questions to this before, but the particular motivating 
example at moment is as follows. In a Table, I want a pop-up cell for a given 
column. The columns in the table are all bound to an NSArrayController which is 
in turn backed by CoreData. The list of possible values for the column with the 
pop-up is also meant to be bound to another NSArrayController which is also 
back by CoreData. I have not yet been able to get this to work. 

I assume that if I understand the nuances of the above listed bindings, I might 
be able to get this to work as I want.

Thanks,
Brian.

___

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: UITableView with cells of varying heights

2010-01-15 Thread Brian Bruinewoud
Be sure to still have a maximum height for each row. Some RSS feeds (eg. 
BetaNews.com) contain the entire article rather than just text. 

Also, some feeds contain images (eg. Online comics and the entire cheese burger 
network stuff).

On 15/01/2010, at 05:16 , Eric E. Dolecki wrote:

 Sure thing: http://www.cimgf.com/2009/09/23/uitableviewcell-dynamic-height/
 
 On Thu, Jan 14, 2010 at 1:06 PM, Jack Carbaugh intrn...@aol.com wrote:
 
 Could you share the tutorial with the group please .. that way if someone
 else searches and finds this thread, they can continue to the tutorial.
 
 thanks!
 jack
 
 
 On Jan 14, 2010, at 10:05 AM, Eric E. Dolecki wrote:
 
 I found a tutorial online just after I emailed this list. Thanks for the
 links!
 
 Eric
 
 On Thu, Jan 14, 2010 at 9:57 AM, Luke the Hiesterman luket...@apple.com
 wrote:
 
 Hmm, those were supposed to be links at the end of the lines.
 
 
 
 http://developer.apple.com/iphone/library/documentation/UIKit/Reference/NSString_UIKit_Additions/Reference/Reference.html#/
 /apple_ref/doc/uid/TP40006893-CH3-SW7
 
 
 
 http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html#/
 /apple_ref/occ/intfm/UITableViewDelegate/tableView:heightForRowAtIndexPath
 :
 
 Luke
 
 On Jan 14, 2010, at 6:56 AM, Luke the Hiesterman wrote:
 
 Calculate label height with [NSString
 
 sizeWithFont:ForWidth:LineBreakMode:].
 sizeWithFont:forWidth:lineBreakMode:
 
 
 Assign cell row heights with [UITableViewDelegate
 
 tableView:heightForRowAtIndexPath:] – tableView:heightForRowAtIndexPath:
 
 
 Luke
 
 On Jan 14, 2010, at 6:46 AM, Eric E. Dolecki wrote:
 
 I am pulling in an RSS feed, and each item has it's own summary of a
 
 varying
 
 amount of text. I am using a table and presently setting the height of
 
 each
 
 row the same to allow for the most text. This looks awful as some items
 
 have
 
 a lot of empty space for it's row.
 
 Is it possible to have a UILabel where I set numberOfLines = 0, set the
 width, and have the height of the label expand vertically to contain
 all
 
 of
 
 the text, and then use it's height to help determine the height the cell
 itself needs to be? The result would be a UITableView with rows of
 
 varying
 
 heights, perfectly framing each row's content.
 
 I was using a UIWebView to display the summary since it came with tons
 
 of
 
 html tags in it, but I've since just stripped all of the tags out of
 
 each
 
 item's summary.
 
 Thanks,
 Eric
 ___
 
 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/luketheh%40apple.com
 
 This email sent to luket...@apple.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/luketheh%40apple.com
 
 This email sent to luket...@apple.com
 
 
 
 
 
 --
 http://ericd.net
 Interactive design and development
 ___
 
 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/intrntmn%40aol.com
 
 This email sent to intrn...@aol.com
 
 
 
 
 -- 
 http://ericd.net
 Interactive design and development
 ___
 
 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/brian%40darknova.com
 
 This email sent to br...@darknova.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: NSDate without time portion

2010-01-06 Thread Brian Bruinewoud
Wow.

I didn't expect so much conversation from such a 'simple' question. Obviously, 
not a simple question after all.

My iPhone app records events input by the user. The user can then view a list 
of events with a count for each day on which there was at least one event.

I've stuck with the code I originally posted:

   NSDateFormatter *dateFmter = [[NSDateFormatter alloc] init];
   [dateFmter setTimeStyle:NSDateFormatterNoStyle];
   [dateFmter setDateStyle:NSDateFormatterMediumStyle];

   NSString dateText = [ dateFmter stringFromDate: self.now ]; // !! !! I need 
dateText anyway

   self.now = [ dateFmter dateFromString: dateText ]; // !! truncate time to 
00:00:00

From the conversation above, my understanding is as follows:

If 'self.now' is now: 2010-01-06 20:40:00 (UTC+11) at the beginning* of the the 
above code, it will actually be stored as (2010-01-06 10:40:00 UTC) minus epoch 
as seconds in the memory. 

At the end of the code, it will store 2010-01-06 00:00:00 (UTC+11) as 
2010-01-05 14:00:00 UTC minus epoch.

Now, if I take the iPhone over to Greenwich, which oscillates between north and 
south London, and I look at the event, it will say it happened 'Yesterday' 
2010-01-05 instead of when I thought it happened, ie: today 2010-10-06. This 
could be confusing to the user.

Is that a good summary?

I'm not sure how NSDateComponents would stop the user getting confused in this 
instance.

I'm betting on my users (a) not travelling much; (b) not having events around 
midnight and (c) not looking at the list of events very often or very 
carefully. So, in summary, I don't care :) 

If I did care, it seems to me that the only option would be to store the date 
as a string or to store the date and the timezone and display both or something 
based on the timezone, like a location... (20:40:00 in Melbourne, Australia 
rather than 20:40:00 AEDT, etc).

Meh.

Thanks,
Brian.

*is 'beginning' really spelled with two 'n's? I get red dots under it with one 
'n'...___

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


NSDate without time portion

2010-01-04 Thread Brian Bruinewoud
Hi All,

What's the best way to get an NSDate object for 'today' such that the time is 
00:00:00 (or any other constant).
I not interested in the time, I only care about the year-month-day, but I do 
need the the hours-minutes-seconds to be the same on all dates so that I can 
compare the dates.

Currently I do this:

NSDateFormatter *dateFmter = [[NSDateFormatter alloc] init];
[dateFmter setTimeStyle:NSDateFormatterNoStyle];
[dateFmter setDateStyle:NSDateFormatterMediumStyle];

NSString dateText = [ dateFmter stringFromDate: self.now ]; // !! !! I need 
dateText anyway

self.now = [ dateFmter dateFromString: dateText ]; // !! truncate time to 
00:00:00

But this seems ugly, cumbersome and inefficient.

The other option might be to use NSDate, NSCalendar and NSDateComponents, but 
that seems to be even more ugly and cumbersome and probably more inefficient.

Something like NSDate dateForTodayWithNoTimeComponentPleaseKTHXBAI would be 
good.

Regards,
Brian.

(Apologies for gratuitous 
LOLspeak)___

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 CoreData classes

2009-12-29 Thread Brian Bruinewoud
Ah, that seems perfect (haven't tried it yet), but it claims to do what I want.
Thanks.

On 28/12/2009, at 17:51 , Rob Keniger wrote:

 On 28/12/2009, at 2:52 PM, Brian Bruinewoud wrote:
 But I'm looking for something more like this:
 
   CDClass *cdObject = [ CDClass insertNewObjectInManagedObjectContext: 
 context ];
 
 Is there any such method or do I need to add them to the generated class 
 files myself?
 
 
 If you use mogenerator to create your custom NSManagedObject subclasses, you 
 get methods like this created for you automatically:
 
 http://github.com/rentzsch/mogenerator
 
 --
 Rob Keniger
 
 
 
 ___
 
 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/brian%40darknova.com
 
 This email sent to br...@darknova.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


Creating CoreData classes

2009-12-27 Thread Brian Bruinewoud
If I've generated core data classes from my model, how do I use them to create 
new values?
Currently I'm doing this:

CDClass *cdObject = (CDClass *)[ NSEntityDescription 
insertNewObjectForEntityForName: @CDClass inManagedObjectContext: context ];

But I'm looking for something more like this:

CDClass *cdObject = [ CDClass insertNewObjectInManagedObjectContext: 
context ];

Is there any such method or do I need to add them to the generated class files 
myself?
 

[this is for iPhone, but I don't think that that's relevant]


___

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: Compile errors with Objective-C++ properties as STL/TR1 smart pointers

2009-12-26 Thread Brian Bruinewoud
It's probably just a parsing thing, have you tried:
 ::NSLog(@The value's amount is %d, (valueUser.value)-GetAmount());
?


On 27/12/2009, at 11:20 , Tron Thomas wrote:

 I'm running into a issue using STL/TR1 smart pointers with Objective-C++ 
 properties that I think is a bug, and I wanted to get some feedback before I 
 submitted any bug report.
 
 The following code:
 
 #import Cocoa/Cocoa.h
 #import tr1/memory
 
 class Value
 {
 public:
explicit Value(int amount) : m_amount(amount){}
 
int GetAmount() const { return m_amount; }
 
 private:
int m_amount;
 };
 
 typedef std::tr1::shared_ptrValue ValuePtr;
 
 @interface ValueUser : NSObject
 {
 @private
ValuePtr* _valuePtr;
 }
 - (id)initWithValue:(ValuePtr)valuePtr;
 @property ValuePtr value;
 @end
 
 @implementation ValueUser
 - (id)initWithValue:(ValuePtr)valuePtr
 {
self = [super init];
_valuePtr = new ValuePtr(valuePtr);
return self;
 }
 
 - (void)setValue:(ValuePtr)valuePtr
 {
*_valuePtr = valuePtr;
 }
 
 - (ValuePtr)value
 {
return *_valuePtr;
 }
 
 - (void)dealloc
 {
delete _valuePtr;
[super dealloc];
 }
 @end
 
 int main()
 {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
 
ValuePtr valuePtr(new Value(42));
ValueUser* valueUser = [[ValueUser alloc] initWithValue:valuePtr];
 
::NSLog(@The value's amount is %d, valueUser.value-GetAmount());
 
[valueUser release];
 
[pool release];
 
return 0;
 }
 
 will produce these errors on the line in the main function containing the 
 NSLog call:
 error: lvalue required as unary ‘’ operand
 error: base operand of ‘-’ has non-pointer type ‘ValuePtr’
 
 If I replace the line with:
::NSLog(@The value's amount is %d, [valueUser value]-GetAmount());
 
 Everything compiles successfully.  What is the reason the '.' syntax will not 
 work in this instance?
 
 ___
 
 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/brian%40darknova.com
 
 This email sent to br...@darknova.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


[iPhone] Refreshing a UITableView in a UINavigationController...

2009-12-26 Thread Brian Bruinewoud
Hi all,

I have a navigation controller based app consisting mostly of table views.
Table View 1 moves you to Table View 2 when you select a row.
When you return from Table View 2, Table View 1 needs to be updated to show the 
changes made.
There is no fetchedResultsController for Table View 1.
I know that Table View 1 will need to be update 90% of the time.
I've done the following in Table View 1's controller:

- (void)viewDidAppear:(BOOL)animated 
{
[super viewDidAppear:animated];

if( self.beenHereBefore )
[self.tableView reloadData];

self.beenHereBefore = YES;
}

This solution seems to work.

My question is, is this the best way to do this and is this the best method to 
do it in?
Perhaps viewWillAppear is better?
Perhaps reloadData before calling super?

Thanks.

___

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: [Solved] IPhone- Datasensitive bug from CoreData...

2009-12-25 Thread Brian Bruinewoud
Ironically, it wasn't that I was overreleasing something but rather that I was 
under releasing. 
Specifically, the fetchedResultsController's delegate was a view controller. 
The view controller owned the fetchedResultsController. Presumably a fairly 
common pattern.
However, the view controller's dealloc didn't release the 
fetchedResultsController, so when the data changed, it was still observing it 
and tried to the tell its delegate.

I'm a little surprised that the view controller was dealloced as it was still 
on the navigationController stack (one below the current view). Reading about 
the navigation controller now...

On 26/12/2009, at 01:29 , Kyle Sluder wrote:

 On Dec 25, 2009, at 12:48 AM, Brian Bruinewoud br...@darknova.com wrote:
 
 *** -[NSCFType controllerDidChangeContent:]: unrecognized selector sent to 
 instance 0x3a11d70
 
 Usually this is a sign of a memory management error, specifically an 
 overrelease. Run with zombies enabled to find it.
 
 --Kyle Sluder

___

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

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

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

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


Is there a warning for this?

2009-12-24 Thread Brian Bruinewoud
All,

I had this code:

[[fetchedResultsController sections] count]

Which always returned zero even thought sglite showed entries in the table.
When I put a break point on the getter, nothing happened.

Amazingly, it dawned on me pretty quickly that I needed this:

[[self.fetchedResultsController sections] count]

(notice the 'self' at the start)

Is there some way to turn on a warning saying 'you are directly accessing an 
ivar where a (non-trivial) getter/setter exists'?

Thanks.___

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: [textView:shouldChangeTextInRanges:replacementStrings:] When does this type of event occur?

2009-12-24 Thread Brian Bruinewoud
How about replace all?

I haven't done any text programming so I'm not sure how much functionality the 
API offers. So this is purely a guess :)

On 24/12/2009, at 19:39 , Iceberg-Dev wrote:

 
 On Dec 23, 2009, at 10:58 PM, Dave DeLong wrote:
 
 In many apps, you can hold down the option key to change the cursor into a 
 crosshair, and do a vertical selection.  In addition, in apps like Pages, 
 you can hold down the command key to do a non-contiguous selection.  I'd 
 imagine that both of these scenarios might result in that method getting 
 invoked.
 
 That explains how to get a non-continuous selection but not how you can 
 change the text in multiple locations.
 
 Let's say you have a non-continuous selection and you type or paste some 
 text, it just delete the selection and insert the new text in the first 
 selection range (tested in TextEdit).
 
 
 
 
 ___
 
 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/brian%40darknova.com
 
 This email sent to br...@darknova.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: Is there a warning for this?

2009-12-24 Thread Brian Bruinewoud

On 25/12/2009, at 01:20 , Kyle Sluder wrote:

 On Dec 24, 2009, at 3:26 AM, Brian Bruinewoud br...@darknova.com wrote:
 
 Is there some way to turn on a warning saying 'you are directly accessing an 
 ivar where a (non-trivial) getter/setter exists'?
 
 I'm assuming you're targeting iPhone OS.
 
 If you can deal with not running your code in the simulator, switching to 
 synthesized ivars where possible might avoid this situation in most cases, 
 since you would either need self. or self- to access the property/ivar. 
 Otherwise, give your ivars a prefix (underscore is verboten according to 
 Apple, since they use it in the frameworks).
 
 Oh, and if not being able to use the new runtime (and therefore synthesized 
 ivars) in the simulator bothers you, file a bug. Same with the lack of 
 namespacing leading to rules like thou shalt not prefix identifiers with 
 underscores. If enough of us complain about something, Apple might take our 
 opinions into consideration.
 
 --Kyle Sluder

Thanks Kyle and Alexander.

I am indeed targeting iPhone OS in this particular example, though I didn't 
think that was particularly relevant. Would your answer change if I wasn't 
(other than discussing the simulator's limitations, obviously)?

Looks like I'll get into the habit of giving iVars a prefix or using synthesis 
where possible.

Thanks,
Brian.___

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


IPhone- Datasensitive bug from CoreData...

2009-12-24 Thread Brian Bruinewoud
This has me totally stumped.

I have an app that contains (currently) three Entities:
Person
Deed; and
DeedDoneByPerson

Deed is effectively a template object. I'll probably re-do the object model but 
I want to understand what's going on with this bug first.

Deeds can be good or not and have a degree of goodness.

Here is the code that creates a new deed and deedDoneByPerson:

NSManagedObject *newDeed = [ NSEntityDescription 
insertNewObjectForEntityForName: @Deed 
  
inManagedObjectContext: context ];

int score;
if( self.isGood )  score =   sender.tag;
else   score = - sender.tag; 
 
[newDeed setValue: self.deedName.text   
forKey: @deedName ];
[newDeed setValue: [ NSNumber numberWithBool: self.isGood ] 
forKey: @isGood   ];
[newDeed setValue: [ NSNumber numberWithInt:  score   ] 
forKey: @points   ];

NSManagedObject *newDeedDoneByPerson = [ NSEntityDescription 
insertNewObjectForEntityForName: @DeedDoneByPerson 
  
inManagedObjectContext: context ];

[newDeedDoneByPerson setValue: newDeed  
forKey: @deedDone ];
[newDeedDoneByPerson setValue: selectedPerson   
forKey: @byPerson ];
[newDeedDoneByPerson setValue: [ NSNumber numberWithBool: self.isGood ] 
forKey: @isGood   ];
// let 'points' and 'instances' default

FYI2( @:: Create new deed [...@], self.deedName.text );
NSError *error;
if (![context save:error]) //!!! CRASHES HERE  
{
NSLog(@!! Unresolved error %@, %@, error, [error userInfo]);
abort();
}


The following scenarios work:
With a fresh app (deleted from the simulator and re-installed), create a person 
and add any number of bad deeds to that person - they are displayed correctly 
and sqlite has the expected contents.
With a fresh app (deleted from the simulator and re-installed), create a person 
and add any number of good deeds to that person - they are displayed correctly 
and sqlite has the expected contents.
With a fresh app (deleted from the simulator and re-installed), create a person 
and add any number of bad deeds to that person - they are displayed correctly 
and sqlite has the expected contents. Then create another person and add any 
number of good deeds to that person -  they are displayed correctly and sqlite 
has the expected contents

The following scenario does NOT work:
With a fresh app (deleted from the simulator and re-installed), create a person 
and add a bad deed to that person then attempt to add a good deed. BOOM

Stack trace:
#0  0x93affedb in objc_msgSend
#1  0x939f4b6c in ??
#2  0x0001763a in _nsnote_callback
#3  0x01d34005 in _CFXNotificationPostNotification
#4  0x00014ef0 in -[NSNotificationCenter 
postNotificationName:object:userInfo:]
#5  0x01ba717d in -[NSManagedObjectContext(_NSInternalNotificationHandling) 
_postObjectsDidChangeNotificationWithUserInfo:]
#6  0x01c06763 in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
_createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:]
#7  0x01b8b5ea in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
_processRecentChanges:]
#8  0x01bc1728 in -[NSManagedObjectContext save:]
#9  0x5434 in -[NewDeedViewController commit:] at 
NewDeedViewController.m:131 --- CODE ABOVE
#10 0x00298459 in -[UIApplication sendAction:to:from:forEvent:]
#11 0x002fbba2 in -[UIControl sendAction:to:forEvent:]
#12 0x002fddc3 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]
#13 0x002fcb0f in -[UIControl touchesEnded:withEvent:]
#14 0x002b1e33 in -[UIWindow _sendTouchesForEvent:]
#15 0x0029b81c in -[UIApplication sendEvent:]
#16 0x002a20b5 in _UIApplicationHandleEvent
#17 0x0252cef1 in PurpleEventCallback
#18 0x01d40b80 in CFRunLoopRunSpecific
#19 0x01d3fc48 in CFRunLoopRunInMode
#20 0x0252b7ad in GSEventRunModal
#21 0x0252b872 in GSEventRun
#22 0x002a3003 in UIApplicationMain
#23 0x1cb4 in main at main.m:14

I don't understand how the value of 'score' breaks things. If I get rid of the 
negation in this code:
int score;
if( self.isGood )  score =   sender.tag;
else   score = - sender.tag; 
everything works fine: adding good and bad to the same person is acceptable.

Any suggestions on what to investigate?


___

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:

Re: IPhone- Datasensitive bug from CoreData...

2009-12-24 Thread Brian Bruinewoud
Oh, sorry, here is the message in the Console:

*** -[NSCFType controllerDidChangeContent:]: unrecognized selector sent to 
instance 0x3a11d70
Serious application error.  Exception was caught during Core Data change 
processing: *** -[NSCFType controllerDidChangeContent:]: unrecognized selector 
sent to instance 0x3a11d70 with userInfo (null)
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
reason: '*** -[NSCFType controllerDidChangeContent:]: unrecognized selector 
sent to instance 0x3a11d70'
Stack: ( ...

On 25/12/2009, at 16:40 , Brian Bruinewoud wrote:

 This has me totally stumped.
 
 I have an app that contains (currently) three Entities:
 Person
 Deed; and
 DeedDoneByPerson
 
 Deed is effectively a template object. I'll probably re-do the object model 
 but I want to understand what's going on with this bug first.
 
 Deeds can be good or not and have a degree of goodness.
 
 Here is the code that creates a new deed and deedDoneByPerson:
 
NSManagedObject *newDeed = [ NSEntityDescription 
 insertNewObjectForEntityForName: @Deed 
  
 inManagedObjectContext: context ];
 
int score;
if( self.isGood )  score =   sender.tag;
else   score = - sender.tag; 
 
[newDeed setValue: self.deedName.text   
 forKey: @deedName ];
[newDeed setValue: [ NSNumber numberWithBool: self.isGood ] 
 forKey: @isGood   ];
[newDeed setValue: [ NSNumber numberWithInt:  score   ] 
 forKey: @points   ];
 
NSManagedObject *newDeedDoneByPerson = [ NSEntityDescription 
 insertNewObjectForEntityForName: @DeedDoneByPerson 
  
 inManagedObjectContext: context ];
 
[newDeedDoneByPerson setValue: newDeed 
  forKey: @deedDone ];
[newDeedDoneByPerson setValue: selectedPerson  
  forKey: @byPerson ];
[newDeedDoneByPerson setValue: [ NSNumber numberWithBool: self.isGood 
 ] forKey: @isGood   ];
// let 'points' and 'instances' default
 
FYI2( @:: Create new deed [...@], self.deedName.text );
NSError *error;
if (![context save:error]) //!!! CRASHES HERE  
{
NSLog(@!! Unresolved error %@, %@, error, [error userInfo]);
abort();
}
 
 
 The following scenarios work:
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add any number of bad deeds to that person - they are displayed 
 correctly and sqlite has the expected contents.
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add any number of good deeds to that person - they are displayed 
 correctly and sqlite has the expected contents.
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add any number of bad deeds to that person - they are displayed 
 correctly and sqlite has the expected contents. Then create another person 
 and add any number of good deeds to that person -  they are displayed 
 correctly and sqlite has the expected contents
 
 The following scenario does NOT work:
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add a bad deed to that person then attempt to add a good deed. BOOM
 
 Stack trace:
 #00x93affedb in objc_msgSend
 #10x939f4b6c in ??
 #20x0001763a in _nsnote_callback
 #30x01d34005 in _CFXNotificationPostNotification
 #40x00014ef0 in -[NSNotificationCenter 
 postNotificationName:object:userInfo:]
 #50x01ba717d in -[NSManagedObjectContext(_NSInternalNotificationHandling) 
 _postObjectsDidChangeNotificationWithUserInfo:]
 #60x01c06763 in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
 _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:]
 #70x01b8b5ea in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
 _processRecentChanges:]
 #80x01bc1728 in -[NSManagedObjectContext save:]
 #90x5434 in -[NewDeedViewController commit:] at 
 NewDeedViewController.m:131 --- CODE ABOVE
 #10   0x00298459 in -[UIApplication sendAction:to:from:forEvent:]
 #11   0x002fbba2 in -[UIControl sendAction:to:forEvent:]
 #12   0x002fddc3 in -[UIControl(Internal) _sendActionsForEvents:withEvent:]
 #13   0x002fcb0f in -[UIControl touchesEnded:withEvent:]
 #14   0x002b1e33 in -[UIWindow _sendTouchesForEvent:]
 #15   0x0029b81c in -[UIApplication sendEvent:]
 #16   0x002a20b5 in _UIApplicationHandleEvent
 #17   0x0252cef1 in PurpleEventCallback
 #18   0x01d40b80 in CFRunLoopRunSpecific
 #19   0x01d3fc48 in CFRunLoopRunInMode
 #20   0x0252b7ad in GSEventRunModal
 #21   0x0252b872 in GSEventRun
 #22   0x002a3003 in UIApplicationMain
 #23   0x1cb4 in main at main.m:14
 
 I don't understand how the value of 'score

Re: IPhone- Datasensitive bug from CoreData...

2009-12-24 Thread Brian Bruinewoud
Final set of information for today.

Sometimes the console just had INVALID INSTRUCTION without any error message.
Mostly its the below error message but with different target objects. The 
latest was UIImageView - as far as I know, I have no UIImageVIew in my app 
(unless it's part of the implementation of another control/view, which makes 
sense).

Finally, another scenario that works:
With a fresh app (deleted from the simulator and re-installed), create a person 
and add a bad deed to that person. Quit and restart the app then attempt to add 
a good deed. Success.

It seems that the bug is triggered when:
1. Adding to the same user
2. In the same session (ie, without quiting the app in between)
3. A new deed that has a score where sign(new-score) != sign(previous-score)

:-(

Until tomorrow...

On 25/12/2009, at 16:48 , Brian Bruinewoud wrote:

 Oh, sorry, here is the message in the Console:
 
 *** -[NSCFType controllerDidChangeContent:]: unrecognized selector sent to 
 instance 0x3a11d70
 Serious application error.  Exception was caught during Core Data change 
 processing: *** -[NSCFType controllerDidChangeContent:]: unrecognized 
 selector sent to instance 0x3a11d70 with userInfo (null)
 *** Terminating app due to uncaught exception 'NSInvalidArgumentException', 
 reason: '*** -[NSCFType controllerDidChangeContent:]: unrecognized selector 
 sent to instance 0x3a11d70'
 Stack: ( ...
 
 On 25/12/2009, at 16:40 , Brian Bruinewoud wrote:
 
 This has me totally stumped.
 
 I have an app that contains (currently) three Entities:
 Person
 Deed; and
 DeedDoneByPerson
 
 Deed is effectively a template object. I'll probably re-do the object model 
 but I want to understand what's going on with this bug first.
 
 Deeds can be good or not and have a degree of goodness.
 
 Here is the code that creates a new deed and deedDoneByPerson:
 
   NSManagedObject *newDeed = [ NSEntityDescription 
 insertNewObjectForEntityForName: @Deed 
 
 inManagedObjectContext: context ];
 
   int score;
   if( self.isGood )  score =   sender.tag;
   else   score = - sender.tag; 
 
   [newDeed setValue: self.deedName.text   
 forKey: @deedName ];
   [newDeed setValue: [ NSNumber numberWithBool: self.isGood ] 
 forKey: @isGood   ];
   [newDeed setValue: [ NSNumber numberWithInt:  score   ] 
 forKey: @points   ];
 
   NSManagedObject *newDeedDoneByPerson = [ NSEntityDescription 
 insertNewObjectForEntityForName: @DeedDoneByPerson 
 
 inManagedObjectContext: context ];
 
   [newDeedDoneByPerson setValue: newDeed 
  forKey: @deedDone ];
   [newDeedDoneByPerson setValue: selectedPerson  
  forKey: @byPerson ];
   [newDeedDoneByPerson setValue: [ NSNumber numberWithBool: self.isGood 
 ] forKey: @isGood   ];
   // let 'points' and 'instances' default
 
   FYI2( @:: Create new deed [...@], self.deedName.text );
   NSError *error;
   if (![context save:error]) //!!! CRASHES HERE  
   {
   NSLog(@!! Unresolved error %@, %@, error, [error userInfo]);
   abort();
   }
 
 
 The following scenarios work:
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add any number of bad deeds to that person - they are displayed 
 correctly and sqlite has the expected contents.
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add any number of good deeds to that person - they are displayed 
 correctly and sqlite has the expected contents.
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add any number of bad deeds to that person - they are displayed 
 correctly and sqlite has the expected contents. Then create another person 
 and add any number of good deeds to that person -  they are displayed 
 correctly and sqlite has the expected contents
 
 The following scenario does NOT work:
 With a fresh app (deleted from the simulator and re-installed), create a 
 person and add a bad deed to that person then attempt to add a good deed. 
 BOOM
 
 Stack trace:
 #0   0x93affedb in objc_msgSend
 #1   0x939f4b6c in ??
 #2   0x0001763a in _nsnote_callback
 #3   0x01d34005 in _CFXNotificationPostNotification
 #4   0x00014ef0 in -[NSNotificationCenter 
 postNotificationName:object:userInfo:]
 #5   0x01ba717d in -[NSManagedObjectContext(_NSInternalNotificationHandling) 
 _postObjectsDidChangeNotificationWithUserInfo:]
 #6   0x01c06763 in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
 _createAndPostChangeNotification:withDeletions:withUpdates:withRefreshes:]
 #7   0x01b8b5ea in -[NSManagedObjectContext(_NSInternalChangeProcessing) 
 _processRecentChanges:]
 #8   0x01bc1728 in -[NSManagedObjectContext save

Re: CoreData SQL tracing in the iPhone Simulator...

2009-09-23 Thread Brian Bruinewoud
That doesn't seem to work in the iPhone Simulator. I set the value in  
XCode, hardcoded it main.m's call to UIApplicationMain and started the  
iPhone Simulator itself with that value, but none of them worked.


Anyone know how to get this working in the Simulator?

On 23/09/2009, at 01:44 , Sean McBride wrote:


On 9/22/09 9:23 PM, Brian Bruinewoud said:


Sorry for asking this but I was unable to find this in the archives
even though I know I read it here before.

How can I turn on logging/tracing of the SQL statements issued by
CoreData? I need this for an iPhone app running in the simulator.


Perhaps you're thinking of -com.apple.CoreData.SQLDebug 1 (passed as
arguments to the app).

--

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




___

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

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

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

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


CoreData SQL tracing...

2009-09-22 Thread Brian Bruinewoud
Sorry for asking this but I was unable to find this in the archives  
even though I know I read it here before.


How can I turn on logging/tracing of the SQL statements issued by  
CoreData? I need this for an iPhone app running in the simulator.


Thanks,
Brian.
___

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


[iPhone 3.0] Flipping view doesn't play nice with Navigation and Tab bars.

2009-09-01 Thread Brian Bruinewoud

I have a Navigation Controller based app.
In one of the view that can be navigated to, I have a tab bar and an  
(i) for information.

Tapping the (i) flips the view to show the settings on the 'back'.

All standard navigation methods and all more-or-less working EXCEPT,  
that the back-side view doesn't display properly:
It resizes to the size of the entire screen even though I designed it  
with Nav Bar and Tab Bar simulations turned on in IB.

It draws on top of Tab Bar but underneath the Nav Bar.

I would like to fix this so it behaves a bit more sanely:
Preferred solution would be to have the back view fill the space  
between the Nav and Tab bars without drawing over or beneath them.
Second best solution would be to have the back view fill the whole  
screen but draw beneath the two Bars.
Third best solution would be to have the back view fill the whole  
screen and draw on top of both the Bars.


Any way I can achieve any of these?

Examples using Tab Bars with Nav Bars seem fairly rare. Using them  
with back-side views or whatever they're called seems pathological.  
What are these back-side views called?


Thanks,
Brian.
___

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 3.0] Flipping view doesn't play nice with Navigation and Tab bars.

2009-09-01 Thread Brian Bruinewoud

If it matters, here's the code I'm using to show the back view:

- (IBAction) showInfo
{
	GraphSettingsViewController *controller =  
[[GraphSettingsViewController alloc]  
initWithNibName:@GraphSettingsView bundle:nil];

controller.delegate = self;

controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:controller animated:YES];

[controller release];
}


On 01/09/2009, at 20:07 , Brian Bruinewoud wrote:


I have a Navigation Controller based app.
In one of the view that can be navigated to, I have a tab bar and an  
(i) for information.

Tapping the (i) flips the view to show the settings on the 'back'.

All standard navigation methods and all more-or-less working EXCEPT,  
that the back-side view doesn't display properly:
It resizes to the size of the entire screen even though I designed  
it with Nav Bar and Tab Bar simulations turned on in IB.

It draws on top of Tab Bar but underneath the Nav Bar.

I would like to fix this so it behaves a bit more sanely:
Preferred solution would be to have the back view fill the space  
between the Nav and Tab bars without drawing over or beneath them.
Second best solution would be to have the back view fill the whole  
screen but draw beneath the two Bars.
Third best solution would be to have the back view fill the whole  
screen and draw on top of both the Bars.


Any way I can achieve any of these?

Examples using Tab Bars with Nav Bars seem fairly rare. Using them  
with back-side views or whatever they're called seems pathological.  
What are these back-side views called?


Thanks,
Brian.
___

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/brian%40darknova.com

This email sent to br...@darknova.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 3.0] How do I make a UITextField the first responder?

2009-08-26 Thread Brian Bruinewoud

Ok, apologies to Georg.
That does work.
My fingers still type 'NS' by default sometimes, it seems :(

Thanks all.

On 25/08/2009, at 23:02 , Andy Lee wrote:


On Aug 25, 2009, at 8:28 AM, Brian Bruinewoud wrote:

On 25/08/2009, at 20:42 , Georg C. Brückmann wrote:


On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton.  
The user will most often want to type text and ignore the button.  
Is there some way I can make the keyboard appear immediately that  
view is shown? I can't find anything in IB and reading about  
UITextField, UIView, UIWindow, UIResponder didn't enlighten me.


-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
[super viewDidLoad];
[_myTextFieldOutlet becomeFirstResponder];
}

Actually, that's not correct, but while I was checking that I  
noticed that its documentation said


	Use the NSWindow makeFirstResponder: method, not this method, to  
make an object the first responder. Never invoke this method  
directly.


You're reading the Cocoa docs, not the iPhone docs.  There's no  
NSWindow on the iPhone.


The *iPhone* doc for becomeFirstResponder says:

You may call this method to make a responder object such as a view  
the first responder. However, you should only call it on that view  
if it is part of a view hierarchy. If the view’s window property  
holds a UIWindow object, it has been installed in a view hierarchy;  
if it returns nil, the view is detached from any hierarchy.


--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


[IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Brian Bruinewoud

All,

I have a simple view that contains a UITextField and a UIButton. The  
user will most often want to type text and ignore the button. Is there  
some way I can make the keyboard appear immediately that view is  
shown? I can't find anything in IB and reading about UITextField,  
UIView, UIWindow, UIResponder didn't enlighten me.


I've seen it done in apps, not sure how to do it.

Thanks,
Brian.
___

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 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Brian Bruinewoud


On 25/08/2009, at 20:42 , Georg C. Brückmann wrote:


On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton.  
The user will most often want to type text and ignore the button.  
Is there some way I can make the keyboard appear immediately that  
view is shown? I can't find anything in IB and reading about  
UITextField, UIView, UIWindow, UIResponder didn't enlighten me.


-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
  [super viewDidLoad];
  [_myTextFieldOutlet becomeFirstResponder];
}

Actually, that's not correct, but while I was checking that I noticed  
that its documentation said


	Use the NSWindow makeFirstResponder: method, not this method, to  
make an object the first responder. Never invoke this method directly.


But There is no NSWindow on iPhone.

So far I've tried:

[ self.textField makeFirstResponder ];

[ self makeFirstResponder: textField ];

UIWindow *win = [((AppDelegate*)[[ UIApplication  
sharedApplication ] delegate ]) window ];

[ win makeFirstResponder: self. textField ]

They all complain about the object may not respond to '- 
makeFirstResponder'


Brian.___

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 3.0; XCode 3.1.3] Question about when views are available for manipulation.

2009-08-19 Thread Brian Bruinewoud

Resending because I never saw this appear in the list.

On 10/08/2009, at 21:51 , Brian Bruinewoud wrote:


I found the motivating example for this thread.

Files are:
http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/DirectoryViewController.m
http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/FileOverviewViewController.m

For this book:
http://books.pragprog.com/titles/amiphd/iphone-sdk-development

The methods of significance are as follows:
In DirectoryViewController's tableView:didSelectRowAtIndexPath: the  
code creates a new FileOverviewViewController and sets its filePath  
property.
In FileOverviewViewController's setFilePath: method, the code calls  
[self updateFileOverview]
In FileOverviewViewController's updateFileOverview, the code updates  
GUI elements (UILabel.text)


Is this all ok? Going on the previous discussion, I don't think so  
(and I hope I'm right).


To fix, it would be sufficient to remove [self updateFileOverview]  
from setFilePath and put it in viewWillAppear. Right?


I already raised a bug against the book for other elements of  
setFilePath being incorrect/non-idiomatic, looks like there might be  
another...


Please confirm or clarify my understandings,
Thanks,
Brian.


___

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 3.0; XCode 3.1.3] Question about when views are available for manipulation.

2009-08-10 Thread Brian Bruinewoud

All,

Thanks for the responses so far. I'm getting there.

If I may quote Henry McGilton (Boulevardier) out of order:

On 10/08/2009, at 15:02 , Henry McGilton (Boulevardier) wrote:

Similar situation with the call to makeKeyAndVisible - I've seen  
samples of applicationDidFinishLaunching where makeKeyAndVisible is  
called and then set up is done to the main window's view.


I (and I am sure many others) would be highly interested to see  
these sample codes to which
you refer.In general, if you make the window visible first and  
then load up your initial screen
and add it to the window, the user will see a (possibly unpleasant)  
'flash' as the new stuff is added.
A more user-friendly approach is to (quickly) load the initial UI,  
add it to the window, and then

display the window.


It is not an Apple example.

Example: 
http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/FilesystemExplorerAppDelegate.m
For this book: http://books.pragprog.com/titles/amiphd/iphone-sdk-development

But I agree with you that it could cause a flash of invalid data/ 
layout, followed by the correct data/layout.
So, is the above example broken? Note that the property directoryPath  
has an explicit setDirectoryPath method that can be seen here:

http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/DirectoryViewController.m

So, I have one last question about what you said here:

In the first simple alloc-init style, the design assumption is that  
the View Controller will fabricate
its managed view 'manually' *when the View Controller is asked to do  
so* by referencing its view property.


In the second, initWithNibName style, the design assumption is that   
initWithNibName tells
the newly allocated View Controller the name of the NIB that it  
*will* load (in the future)
*when the View Controller is asked to do so* by referencing its view  
property.


In the normal course of events, when is the View Controller asked to  
fabricate its managed view?


- (IBAction) readFileContents {
FileContentsViewController *fileContentsViewController =
[[FileContentsViewController alloc]
initWithNibName: @FileContentsView
bundle:nil];
fileContentsViewController.filePath = filePath;
	fileContentsViewController.title = [NSString stringWithFormat: @%@  
contents,

[filePath lastPathComponent]];
[[self navigationController] pushViewController:
fileContentsViewController animated:YES];
[fileContentsViewController release];
}

Thanks for all your help.
___

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 3.0; XCode 3.1.3] Question about when views are available for manipulation.

2009-08-10 Thread Brian Bruinewoud

I found the motivating example for this thread.

Files are:
http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/DirectoryViewController.m
http://media.pragprog.com/titles/amiphd/code/FileIO/FilesystemExplorer/Classes/FileOverviewViewController.m

For this book:
http://books.pragprog.com/titles/amiphd/iphone-sdk-development

The methods of significance are as follows:
In DirectoryViewController's tableView:didSelectRowAtIndexPath: the  
code creates a new FileOverviewViewController and sets its filePath  
property.
In FileOverviewViewController's setFilePath: method, the code calls  
[self updateFileOverview]
In FileOverviewViewController's updateFileOverview, the code updates  
GUI elements (UILabel.text)


Is this all ok? Going on the previous discussion, I don't think so  
(and I hope I'm right).


To fix, it would be sufficient to remove [self updateFileOverview]  
from setFilePath and put it in viewWillAppear. Right?


I already raised a bug against the book for other elements of  
setFilePath being incorrect/non-idiomatic, looks like there might be  
another...


Please confirm or clarify my understandings,
Thanks,
Brian.
___

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


[iPhone 3.0; XCode 3.1.3] Question about when views are available for manipulation.

2009-08-08 Thread Brian Bruinewoud

Hi,

I'm a little confused about how this code works:

MyController *myController = [[ myController alloc ]  
initWithNibName: @myView bundle: nil ];
[[ self navigationController ] pushViewController:  
myController animated: YES ];

myController.myProperty = itsValue;
[ myController release ];

I always see the view set-up code (in this case  
myController.myProperty = itsValue) after the view has been  
displayed. It makes more sense to me to set up the view before calling  
pushViewController but this doesn't work. For example, if myProperty  
has a non-synthesized setter that expects IBOutlets to be bound it  
will be disappointed as they'll still be nil at this point.


So, my questions are:

Why doesn't initWithNibName create and bind all the IBOutlets before  
it returns?

Is the view guaranteed to be visible after pushViewController returns?
Or is it still animating on another thread?
Or is the request to display the view merely queued for the next loop  
through the RunLoop?


Similar situation with the call to makeKeyAndVisible - I've seen  
samples of applicationDidFinishLaunching where makeKeyAndVisible is  
called and then set up is done to the main window's view.


Thanks,
Brian.

___

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 3.0; XCode 3.1.3] Question about when views are available for manipulation.

2009-08-08 Thread Brian Bruinewoud

Thanks for the replies so far.

Lazy loading makes sense.

But what you say bellow suggests that the code in my original post is  
broken - or at least, potentially broken.


The design comes from a beta version iPhone SDK Development by Bill  
Dudney and Chris Adamson.
They use something very similar every time they load a new view in  
response to user action, such a responding to  
tableView:didSelectRowAtIndexPath: where they need to tell the new  
view what instance it's meant to display. As such, it's a method of  
passing arguments down to the new view. This can't really be done in  
viewDidLoad because that's in the new view, not the 'calling' view.


Is the way they are doing it incorrect? Ill advised or not just not as  
good as it could be? What would be the better way to achieve this?


At a guess to my second question: I suppose the new view should call  
on methods/properties of its File's Owner to discover what it needs to  
display. I haven't tried this so I don't know if its a workable  
solution, but it seems like it could be.


Thanks,
Brian.

On 08/08/2009, at 23:35 , Luke the Hiesterman wrote:



On Aug 8, 2009, at 1:23 AM, Brian Bruinewoud wrote:

Why doesn't initWithNibName create and bind all the IBOutlets  
before it returns?
Is the view guaranteed to be visible after pushViewController  
returns?

Or is it still animating on another thread?
Or is the request to display the view merely queued for the next  
loop through the RunLoop?


Kyle already answered the question about lazy nib loading. I'll  
answer the others by saying no, you shouldn't expect the view to be  
displayed after calling pushViewController. I KNOW that it's not  
displayed immediately if you call pushViewController:animated:YES. I  
don't recall off the top of my head if it will display immediately  
with animated:NO, but you definitely should not rely on that either  
way.


You should be overriding methods from UIViewController to accomplish  
the kind of setup you're talking about. It sounds like viewDidLoad  
is probably what you want. If you override this method, it will give  
you an opportunity to setup properties after the view controller's  
view has loaded. Alternatively, there is viewWillAppear: and  
viewDidAppear: that let you do things right around the actual  
display of the view.


Luke


___

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


Creating a 'complex' ArrayController based view.

2009-06-24 Thread Brian Bruinewoud

All,

I'm ok with creating a special view for a simple value - that is, a  
single item.
I'm not sure what the best way is to design a view that displays items  
from an array.


For the single item view, the view is based on three values that are  
bound to the view. (eg: width, height, colour)
For the complex collection view, the view is based on these 'single  
views' (one per item in the array) but there are additional values  
taken from the array to indicate other properties. (eg: x-coord, y- 
coord).


If I were just writing the single item view I wouldn't care so much  
and I'd just write the view simply overriding the drawRect and getting  
the values from the source controller directly.


However, the collection view complicates things- firstly, the single  
view version is now required to be reusable in both the single and  
collection views.


So, my questions are:
Should I write a shared function, object or Cell that draws the view  
and is used by both the single and collection views? Or something else?
Should I iterate the array controller in the collection view's  
drawRect or should I observer the controller or its array or  
something? (in the application the array is VERY unlikely to have 100  
items, even 20 is probably would be unusual)


Thanks,
Brian.
___

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: Warnings suggest compiler confusion between 32 and 64 bit code.

2009-06-23 Thread Brian Bruinewoud

Thanks to all the responses.
-Wconversion made the warnings go away.
Hopefully that wont come back and bite me later...

On 23/06/2009, at 15:11 , Kyle Sluder wrote:

On Mon, Jun 22, 2009 at 9:01 PM, Michael Ashmichael@gmail.com  
wrote:
I think you mean -Wshorten-64-to-32. -Wconversion warns you every  
time

a function call has the parameter passing altered by the presence of
the function's prototype, which is to say that it will warn you every
time you call any function (or method) which takes a char, unsigned
char, short, unsigned short, or float. Not exactly useful.


You are indeed correct, I had confused the two.

--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/brian%40darknova.com

This email sent to br...@darknova.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


Warnings suggest compiler confusion between 32 and 64 bit code.

2009-06-22 Thread Brian Bruinewoud

Hi all,

In a custom view I have the following code (simplified for the purpose  
of this post):


- (void)drawRect:(NSRect)rect
{
// Drawing code here.
NSRect bounds = [ self bounds ];

 NSLog( @size of CGFloat %d, float %d, double %d, literal float  
%d, literal %d, long literal %d,
	sizeof( CGFloat ), sizeof( float ), sizeof( double ), sizeof( 0.0f ),  
sizeof( 0.0 ), sizeof( 0.0L ));


CGFloat x = bounds.origin.x;
CGFloat y = bounds.origin.y;

CGFloat c = 0.0L; / 
 BATCH 3 **/


[[ NSColor colorWithDeviceRed: c green: c blue: c alpha: 0.33L ]  
setFill ]; /** BATCH 1 **/


NSRect area = NSMakeRect( x, y, x, y ); / 
** BATCH 2 **/

}

The code works as expected but I get the following warnings:
The line at BATCH 1:
warning: passing argument 1 of 'colorWithDeviceRed:green:blue:alpha:'  
as 'float' rather than 'double' due to prototype
warning: passing argument 2 of 'colorWithDeviceRed:green:blue:alpha:'  
as 'float' rather than 'double' due to prototype
warning: passing argument 3 of 'colorWithDeviceRed:green:blue:alpha:'  
as 'float' rather than 'double' due to prototype
warning: passing argument 4 of 'colorWithDeviceRed:green:blue:alpha:'  
as 'float' rather than 'double' due to prototype


The line at BATCH 2:
warning: passing argument 1 of 'NSMakeRect' as 'float' rather than  
'double' due to prototype
warning: passing argument 2 of 'NSMakeRect' as 'float' rather than  
'double' due to prototype
warning: passing argument 3 of 'NSMakeRect' as 'float' rather than  
'double' due to prototype
warning: passing argument 4 of 'NSMakeRect' as 'float' rather than  
'double' due to prototype


The line at BATCH 3:
(no warnings)

Note that if I change the assign of c to just plain 0.0 (ie, no L) I  
get the following warnings:


The line at BATCH 1:
(as above)

The line at BATCH 2:
(as above)

The line at BATCH 3:
warning: implicit conversion shortens 64-bit value into a 32-bit value

Note that the NSLog line logs this:
size of CGFloat 4, float 4, double 8, literal float 4, literal 8, long  
literal 16


What's going on?

NSLog shows that CGFloat is a float.
GCC complains about storing an 8 byte floating point literal into a 4  
byte floating point literal but is silent when storing a 16 byte  
floating point literal... weird.
The prototypes of expect floats and I'm giving floats. So why the  
warnings?


I vaguely recall that there's some old C rule that says all floats are  
passed as doubles (and all ints shorter than int are passed as int or  
something) but

a) I'm not sure that applies in C99
b) GCC should be clever enough to not provide a warning in this instance
c) It didn't in the past and I don't recall changing the GCC settings  
in my project - it's not something I've bothered with yet.


Any ideas or suggestions?

thanks,
Brian


___

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: [SOLVED] Rendering OpenGL in timed loop (CoreVideo).

2009-04-12 Thread Brian Bruinewoud

That did it, adding
[[ self openGLContext ] flushBuffer ];
To the end of getFrameForTime: did the trick.

Thanks.

On 12/04/2009, at 03:13 , Michael Ash wrote:

On Sat, Apr 11, 2009 at 2:20 AM, Brian Bruinewoud  
br...@darknova.com wrote:
Ok. That works. I was coming from an NSOpenGLView example where  
the view

sets the context before the drawRect is sent.

Any it, doesn't crash/hang/stop now, but it doesn't draw anything,  
either...

:(


Does identical code placed in drawRect: (without the context setting
stuff, of course) draw? If so, it's probably a flushing problem. Be
sure to flush your GL context before you exit.

I thought of another possible approach. Since NSOpenGLView tries to
act like a regular NSView, it may be sufficient to wrap your calls in
a lockFocus/unlockFocus pair.

Mike
___

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/brian%40darknova.com

This email sent to br...@darknova.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: Rendering OpenGL in timed loop (CoreVideo).

2009-04-11 Thread Brian Bruinewoud
Ok. That works. I was coming from an NSOpenGLView example where the  
view sets the context before the drawRect is sent.


Any it, doesn't crash/hang/stop now, but it doesn't draw anything,  
either... :(


Oh well.

On 11/04/2009, at 14:18 , Michael Ash wrote:


You can't just go and start calling OpenGL functions like that. OpenGL
depends on having a context set up, and each call is executed in that
context. This CoreVideo callback does nothing like that. All it does
is notify you each time the monitor is done refreshing. It's up to you
to set up your own GL context before you start making calls to GL
functions. I'm not 100% sure about how you do this, but I believe it
would be something like this:

NSOpenGLContext *savedCtx = [NSOpenGLContext currentContext];
[[self openGLContext] makeCurrentContext];
// your GL code here
[savedCtx makeCurrentContext];

Mike

___

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


Rendering OpenGL in timed loop (CoreVideo).

2009-04-10 Thread Brian Bruinewoud

All,

I'm trying to run an OpenGL animation. At first I tried an NSTimer,  
but couldn't get the output to appear unless I resized the window. It  
was as if the redraw caused by NSTimer wasn't swapping buffers or  
whatever whereas the redraw caused by resize was. Note, however, that  
the OpenGL code did work as expected so long as the window was resized.


So I looked around and I found Technical QA QA1385 in ADC Home   
Core Reference Library  Games  Graphics and Imaging.


I already raised a bug on this code (the name of callback differs from  
the name supplied to the CV framework) but have otherwise managed to  
get the code to compile without warnings and run.


However, if I place any openGL code (even just glGetError) in the //  
Add your drawing code here location, the program crashes (NSLog calls  
work fine). Note that the openGL code isn't called until after  
applicationDidFinishLaunching so its not something like partially  
constructed/initialised objects...


The call stack is:
#0  0x92b581c6 in mach_msg_trap
#1  0x92b5f9bc in mach_msg
#2  0x90c270ae in CFRunLoopRunSpecific
#3  0x90c27cd8 in CFRunLoopRunInMode
#4  0x96e6f2c0 in RunCurrentEventLoopInMode
#5  0x96e6f0d9 in ReceiveNextEventCommon
#6  0x96e6ef4d in BlockUntilNextEventMatchingListInMode
#7  0x91e3dd7d in _DPSNextEvent
#8	0x91e3d630 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#9  0x91e3666b in -[NSApplication run]
#10 0x91e038a4 in NSApplicationMain
#11 0x250c in main at main.m:13

What am I missing?

I am perhaps foolishly assuming that nothing more is required to get  
CV working because the article implies that. If that's not the case,  
I'll raise another bug on the article.


Thanks,
Brian.
___

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: Rendering OpenGL in timed loop (CoreVideo).

2009-04-10 Thread Brian Bruinewoud

Oh. Well, the other two threads don't look particularly crashed, either:

Thread 2:
#0  0x92b5f3ae in __semwait_signal
#1  0x92b8a326 in _pthread_cond_wait
#2  0x92b89d0d in pthread_cond_wait$UNIX2003
#3  0x94909b32 in glvmDoWork
#4  0x92b89095 in _pthread_start
#5  0x92b88f52 in thread_start

Thread 3:
#0  0x2adc in -[MainView getFrameForTime:] at MainView.m:132
#1  0x292a in MyDisplayLinkCallback at MainView.m:88
#2  0x938c3d3f in CVDisplayLink::performIO
#3  0x938c42e1 in CVDisplayLink::runIOThread
#4  0x92b89095 in _pthread_start
#5  0x92b88f52 in thread_start

Thread 1 is displayed below.

Why does GDB attache to it and stop execution? If I hit continue,  
nothing happens: no NSLog output, no gdb prompt. When I hit pause,  
thread 1 and 3 seem to be corrupted (or at least missing symbol  
information).


Is there anything useful in this information:

[Session started at 2009-04-11 11:29:06 +1000.]
2009-04-11 11:29:06.307 FirstOpenGLtest[1053:10b] prepare
2009-04-11 11:29:06.382 FirstOpenGLtest[1053:10b] prepareOpenGL
2009-04-11 11:29:06.386 FirstOpenGLtest[1053:10b] reshaping
2009-04-11 11:29:06.387 FirstOpenGLtest[1053:10b] drawRect
2009-04-11 11:29:06.399 FirstOpenGLtest[1053:4c03] MyDisplayLinkCallback
2009-04-11 11:29:06.403 FirstOpenGLtest[1053:4c03] getFrameForTime
2009-04-11 11:29:06.415 FirstOpenGLtest[1053:4c03] MyDisplayLinkCallback
2009-04-11 11:29:06.416 FirstOpenGLtest[1053:4c03] getFrameForTime
2009-04-11 11:29:06.432 FirstOpenGLtest[1053:4c03] MyDisplayLinkCallback
2009-04-11 11:29:06.432 FirstOpenGLtest[1053:4c03] getFrameForTime
2009-04-11 11:29:06.447 FirstOpenGLtest[1053:10b]  
applicationDidFinishLaunching

2009-04-11 11:29:06.447 FirstOpenGLtest[1053:10b] start
2009-04-11 11:29:06.449 FirstOpenGLtest[1053:4c03] MyDisplayLinkCallback
2009-04-11 11:29:06.449 FirstOpenGLtest[1053:4c03] getFrameForTime
2009-04-11 11:29:06.449 FirstOpenGLtest[1053:4c03] ... red = 0.11

[Session started at 2009-04-11 11:29:06 +1000.]
Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40  
UTC 2008)

Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and  
you are
welcome to change it and/or distribute copies of it under certain  
conditions.

Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for  
details.

This GDB was configured as i386-apple-darwin.Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/brian/Documents/04Dev/FirstOpenGLtest/ 
FirstOpenGLtest/build/Debug/FirstOpenGLtest.app/Contents/MacOS/ 
FirstOpenGLtest', process 1053.

[Switching to process 1053 thread 0x4c03]


On 11/04/2009, at 11:22 , Greg Parker wrote:


On Apr 10, 2009, at 6:15 PM, Brian Bruinewoud wrote:
However, if I place any openGL code (even just glGetError) in the  
// Add your drawing code here location, the program crashes  
(NSLog calls work fine). Note that the openGL code isn't called  
until after applicationDidFinishLaunching so its not something like  
partially constructed/initialised objects...


The call stack is:
#0  0x92b581c6 in mach_msg_trap
#1  0x92b5f9bc in mach_msg
#2  0x90c270ae in CFRunLoopRunSpecific
#3  0x90c27cd8 in CFRunLoopRunInMode
#4  0x96e6f2c0 in RunCurrentEventLoopInMode
#5  0x96e6f0d9 in ReceiveNextEventCommon
#6  0x96e6ef4d in BlockUntilNextEventMatchingListInMode
#7  0x91e3dd7d in _DPSNextEvent
#8	0x91e3d630 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:]

#9  0x91e3666b in -[NSApplication run]
#10 0x91e038a4 in NSApplicationMain
#11 0x250c in main at main.m:13


That's not a crash, that's the main thread's run loop waiting  
patiently for something to happen. Look through your other threads  
for the one that actually crashed. (If you get a crash log, the  
crashed thread is specially marked.)



--
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: Rendering OpenGL in timed loop (CoreVideo).

2009-04-10 Thread Brian Bruinewoud

Note that this thread is stopping on the line:

GLint e = glGetError();

And that getFrameForTime looks like this:

- (CVReturn)getFrameForTime:(const CVTimeStamp*)outputTime
{
NSLog( @getFrameForTime );

if( !shouldRun ) return kCVReturnError;

redcomp = redcomp + 0.01;
NSLog( @... red = %f, redcomp );

GLint e = glGetError();

if( !displayList )
{
NSLog( @Create displayList );
}
else
{
NSLog( @Use existing displayList );
}

return kCVReturnSuccess;
}

If I remove the glGetError() line, everything works (NSLog messages  
come spurting out at high speed).


I've looked at the disassembly of the thread and there's nothing  
special happening around the call to glGetError, in fact, immediately  
prior is a call to NSLog which works. I was thinking that maybe  
glGetError was some sort of macro or inline function that might put  
some code in the caller. Doesn't seem to be the case. It's a dynamic  
link stub: dyld_stub_glGetError (as is NSLog).


I'm not sure how to debug this. Any pointers?

On 11/04/2009, at 11:38 , Brian Bruinewoud wrote:


Thread 3:
#0  0x2adc in -[MainView getFrameForTime:] at MainView.m:132
#1  0x292a in MyDisplayLinkCallback at MainView.m:88
#2  0x938c3d3f in CVDisplayLink::performIO
#3  0x938c42e1 in CVDisplayLink::runIOThread
#4  0x92b89095 in _pthread_start
#5  0x92b88f52 in thread_start



___

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


After Hillegass

2009-01-17 Thread Brian Bruinewoud
Firstly: is there a FAQ for this list? I was able to find a FAQ for  
the mailing lists in general but none for this list in particular.


Secondly: I've read the 3rd edition of Hillegass and it has gotten me  
a fair way. What book should I move to next?


I searched the archives and the latest dated e-mails I could find were  
from 2006 and mentioned a Cheeseman book, is this the Cocoa Recipes  
for Mac OS X? That book is from 2002 is there a more up to date or  
better choice?


To help with your suggestions:
I think I got the hang of Objective-C as a language and probably don't  
need a book for that (though feel free to suggest).
When I open an example project, I'm not quite sure how to start  
reading it to understand it.
When I read the documentation for a class, I'm not quite sure how to  
read them (they tell me what all the functions are but don't give much  
indication of how to use them or why, what are the dependencies of one  
on the other, etc).


Any suggestions would be appreciated.

Brian.
___

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


Implementing an Inspector similar to the one in IB.

2009-01-11 Thread Brian Bruinewoud

Hi,

I'm an experienced C++ developer but a relative newbie to Objective-C  
and Cocoa and am learning my way.


I would like to implement an inspector that has views that show/hide  
by clicking on their headings similar to the ones in the Interface  
Builder inspector.


This control doesn't seem to be available in the IB library, though.  
Am I overlooking it? (I checked the splitview and tab view controls as  
I thought that these might do what I want).


If I have to implement it myself, are the any tutorials or suggestions  
as to how to go about it?


Thanks,
Brian
___

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