Re: UICollectionView Moving

2016-03-15 Thread Luke Hiesterman
UICollectionView doesn’t know that your layout is conceptually columns, so when 
a section is empty, it has no concept of what space is appropriate to drop 
items into an empty section. You need to help it out by overriding the 
following method on your layout:

- (NSIndexPath *)targetIndexPathForInteractivelyMovingItem:(NSIndexPath 
*)previousIndexPath withPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);

Luke

On Mar 9, 2016, at 5:58 AM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:

Ok - I think this is the final question.

I've created a layout that is essentially a bunch of ragged bottom columns - 
like a Trello or Kanban board. The items in the collection view are "stories" 
with size around 100x100. To begin with, I prepopulate the underlying datastore 
and things are great, I've got 2, 3 or 4 stories in each column. Dragging 
around works just as expected.

In my case, a column is a SECTION. A 4 column board then has 4 sections.

Problem: if I move ALL the items out of a column (a column is a SECTION) ... I 
can't move anything back INTO the column (section). I don't think the SECTION 
has any HEIGHT if it has no items ... and consequently, dragging a "story" item 
over the area that represents a column does nothing because the CollectionView 
doesn't actually create anything there if I have at 0 item layoutAttributes for 
that section.

Is there a specific way to do this? I still have a supplementary view as the 
column header and it always appears ... and in a UITableView, I think, if I 
have a empty section but have a section header, the built in move functionality 
will allow me to drag an item over the section header and allow me to drop into 
the section (but I can't remember if this is true) --- but dragging an "story" 
item over the supplementary view does nothing.

In the worst case, do I need to keep some sort of hidden item as the first 
element? I take all "stories" out of a column (section), should I put at least 
one, invisible item in the column (section) to keep it available as a drag 
target?

Hope that makes sense - I tend to be wordy.

Thanks,
-Luther



On Tue, Mar 8, 2016 at 12:05 AM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:
Now we're cooking with GAS!!!

override func applyLayoutAttributes(layoutAttributes: 
UICollectionViewLayoutAttributes) {
print("apply layout attributes!: \(titleLabel.text)")
}

Thanks Man!
-Luther



On Mon, Mar 7, 2016 at 11:54 PM, Luke Hiesterman 
<luket...@apple.com<mailto:luket...@apple.com>> wrote:
By teaching a cell to respond to an attribute I merely meant that it should 
override setLayoutAttributes: and do something in there with the relevant 
property. Hope that helps.

Luke

On Mar 7, 2016, at 9:39 PM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:

> teach your cell classes to respond to that property

Want to think about this out loud. Wondering what would 'trigger' a lookup on 
the layout's layoutAttributesForItemAtIndexPath ... and where would I store the 
indexPath I am dragging around.

If I were to be more literal - in my view controller, I handle the 
UIGestureRecognizerState.Began event. At this point, I can get the indexPath of 
the element I am about to move and if I change something on that cell at that 
time, it sticks for the life of the drag without reference to layoutAttributes. 
I also handle the UIGestureRecognizerState.Changed event and again, if I 
retrieve the cell at the gesture's locationInView and change things in it ... 
those changes stick until I let go of the drag.

Stepping into the custom layout for a minute ... as you suggested, I am now 
implementing layoutAttributesForInteractivelyMovingItemAtIndexPath ... and that 
is getting invoked in response to the updateInteractiveMovementTargetPosition 
call I am making as the gesture location changes. Now, I know the collection 
view's methods are triggering the layout's callbacks - but I'm not sure what 
would trigger me to fetch the custom attributes you are suggesting. At a 
minimum, to ask the layout for the attributes at that indexPath, I'd have to 
actually be tracking the 'selectedIndexPath' in which case, I could just get 
the cell and modify it directly.

I guess I'm wondering how to "teach my cells classes to respond to that 
property" ... Cells are reused so I'm not even sure how I'd go about setting up 
and tearing down a KVO type relationship for the specific cell I am dragging 
around. Maybe there is a WWDC video that digs into this? or it's an easy 
explain?

Sorry for being so long-winded. I'm not sure I'm communicating my question 
well. Hope you can understand my underlying question and nudge me the right way 
but at any rate, thanks for your help so far. I'd love to use an elegant, "made 
for CollectionView" solution ... but I

Re: UITableView: combining row moves with insert/delete/reload in animation

2016-03-08 Thread Luke Hiesterman
Great. That sounds like the appropriate work-around.

Luke

On Mar 8, 2016, at 1:33 PM, Jens Alfke 
> wrote:

I was able to work around the problem by moving the reloadRows call to after 
-endUpdates. Of course I had to modify the row numbers to the 
post-insert/delete/move values. It even seems to merge the animations together 
seamlessly.

___

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

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

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

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

Re: UITableView: combining row moves with insert/delete/reload in animation

2016-03-08 Thread Luke Hiesterman
If you’re getting asked to create a row at index 3 from that code snippet, then 
that looks like a UIKit bug. I’d advise filing it at bugreport.apple.com 
including a sample app showing that behavior.

Luke

> On Mar 8, 2016, at 11:26 AM, Jens Alfke  wrote:
> 
> I’m animating a UITableView in response to its backing data changing. I’ve 
> gotten it working with row insertion, deletion and reloads, but now I’m 
> trying to add row movement and it seems like I’ve blown the little view’s 
> mind. Does anyone have experience at combining -moveRowAtIndexPath: with the 
> other operations inside a beginUpdates…endUpdates block?
> 
> Here’s an example of what’s not working. Assume the backing store changes 
> from [A, B, C, D, E, F] to [A, E, B, C, G, F]. This can be expressed as “move 
> row 4 to index 1” and “change (the old) row 3 from 'D' to ‘G’”. So I call:
>   [table beginUpdates];
>   [table moveRowAtIndexPath: 4 toIndexPath: 1];
>   [table reloadRowsAtIndexPaths: @[@3]];
>   [table endUpdates];
> (For simplicity I’m showing the parameters as integers instead of 
> NSIndexPaths.)
> 
> This doesn’t work; what ends up displayed (vertically) is [A, E, B, C, C, F]. 
> Row 4 is C when it should be G. After the -endUpdates call, my dataSource is 
> asked to create a cell at row 3, which it populates with a C. So it looks 
> like the table view is processing the reload before the move, but without 
> taking into account the reordering. So it asks my data source for row 3 when 
> it should ask for row 4.
> 
> So then I tried changing using the new row number (4) in 
> -reloadRowsAtIndexPaths:. This causes an assertion failure down within 
> -endUpdates — "attempt to perform a delete and a move from the same index 
> path”.
> 
> The docs have no advice; the Table View Programming Guide says nothing about 
> -moveRowAtIndexPath:toIndexPath:. The API doc for that method says "You can 
> combine row-move operations with row-insertion and row-deletion operations 
> within a beginUpdates–endUpdates block to have all changes occur together as 
> a single animation” but doesn’t discuss the nuances of row numbering or 
> ordering of operations.
> 
> Anyone got a clue?
> 
> —Jens
> 
> PS: iOS 9.2 (only simulator so far)
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UICollectionView Moving

2016-03-07 Thread Luke Hiesterman
By teaching a cell to respond to an attribute I merely meant that it should 
override setLayoutAttributes: and do something in there with the relevant 
property. Hope that helps.

Luke

On Mar 7, 2016, at 9:39 PM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:

> teach your cell classes to respond to that property

Want to think about this out loud. Wondering what would 'trigger' a lookup on 
the layout's layoutAttributesForItemAtIndexPath ... and where would I store the 
indexPath I am dragging around.

If I were to be more literal - in my view controller, I handle the 
UIGestureRecognizerState.Began event. At this point, I can get the indexPath of 
the element I am about to move and if I change something on that cell at that 
time, it sticks for the life of the drag without reference to layoutAttributes. 
I also handle the UIGestureRecognizerState.Changed event and again, if I 
retrieve the cell at the gesture's locationInView and change things in it ... 
those changes stick until I let go of the drag.

Stepping into the custom layout for a minute ... as you suggested, I am now 
implementing layoutAttributesForInteractivelyMovingItemAtIndexPath ... and that 
is getting invoked in response to the updateInteractiveMovementTargetPosition 
call I am making as the gesture location changes. Now, I know the collection 
view's methods are triggering the layout's callbacks - but I'm not sure what 
would trigger me to fetch the custom attributes you are suggesting. At a 
minimum, to ask the layout for the attributes at that indexPath, I'd have to 
actually be tracking the 'selectedIndexPath' in which case, I could just get 
the cell and modify it directly.

I guess I'm wondering how to "teach my cells classes to respond to that 
property" ... Cells are reused so I'm not even sure how I'd go about setting up 
and tearing down a KVO type relationship for the specific cell I am dragging 
around. Maybe there is a WWDC video that digs into this? or it's an easy 
explain?

Sorry for being so long-winded. I'm not sure I'm communicating my question 
well. Hope you can understand my underlying question and nudge me the right way 
but at any rate, thanks for your help so far. I'd love to use an elegant, "made 
for CollectionView" solution ... but I don't think I'm looking at it correctly 
yet. Just in general I guess, how can a change to the layoutAttributes cause my 
CollectionViewDelegate and DataSources to fetch the cell I'm dragging around 
and change it (or does it not require the delegates or datasources ... ?)

Thanks,
-Luther



On Mon, Mar 7, 2016 at 2:45 PM, Luke Hiesterman 
<luket...@apple.com<mailto:luket...@apple.com>> wrote:
You can create your own subclass of UICollectionViewLayoutAttributes and add 
something like an “isMoving” property to that. Then teach your cell classes to 
respond to that property by changing the background color.

Luke

On Mar 7, 2016, at 11:44 AM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:

Thanks Luke! That was it - I can drag and drop successfully now.

One more question, how do I modify a property of the item I'm dragging around 
if the property is NOT currently in UICollectionViewLayoutAttributes ... I 
don't see a call to the datasource or delegate when I select the cell for 
moving ... so I'm not sure how to change the background color to "red" for 
instance.

Would I have to add my own view to the superview and manually move it around in 
the dragging callbacks?

Thanks!
-Luther


On Mon, Mar 7, 2016 at 11:59 AM, Luke Hiesterman 
<luket...@apple.com<mailto:luket...@apple.com>> wrote:
I’d check your return value for this method in your layout:

- (UICollectionViewLayoutAttributes 
*)layoutAttributesForInteractivelyMovingItemAtIndexPath:(NSIndexPath 
*)indexPath withTargetPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);

Luke

On Mar 7, 2016, at 9:55 AM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:

I followed the directions here,
http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
- to add iOS9 style dragging to my UICollectionView - and it sort of works.

As described in the article, I added a long press gesture recognizer and
wired it in to make calls on the collection view -- but now, if I long
press, the element under my finger disappears. As I drag the transparent
image around, the other elements shift - but I can never see the element I
am dragging around. When I let go, there is simply a hole left where I
"dropped" the element.

I do, very much, have a custom layout and I'm not sure that if, for drag, I
need to do anything special. Do I need to calculate the frame of the item I
am dragging around? I'm not sure what to try next except to roll my own
dragging. Any thoughts or things to try?

Thanks in advance.
__

Re: UICollectionView Moving

2016-03-07 Thread Luke Hiesterman
You can create your own subclass of UICollectionViewLayoutAttributes and add 
something like an “isMoving” property to that. Then teach your cell classes to 
respond to that property by changing the background color.

Luke

On Mar 7, 2016, at 11:44 AM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:

Thanks Luke! That was it - I can drag and drop successfully now.

One more question, how do I modify a property of the item I'm dragging around 
if the property is NOT currently in UICollectionViewLayoutAttributes ... I 
don't see a call to the datasource or delegate when I select the cell for 
moving ... so I'm not sure how to change the background color to "red" for 
instance.

Would I have to add my own view to the superview and manually move it around in 
the dragging callbacks?

Thanks!
-Luther


On Mon, Mar 7, 2016 at 11:59 AM, Luke Hiesterman 
<luket...@apple.com<mailto:luket...@apple.com>> wrote:
I’d check your return value for this method in your layout:

- (UICollectionViewLayoutAttributes 
*)layoutAttributesForInteractivelyMovingItemAtIndexPath:(NSIndexPath 
*)indexPath withTargetPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);

Luke

On Mar 7, 2016, at 9:55 AM, Luther Baker 
<lutherba...@gmail.com<mailto:lutherba...@gmail.com>> wrote:

I followed the directions here,
http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
- to add iOS9 style dragging to my UICollectionView - and it sort of works.

As described in the article, I added a long press gesture recognizer and
wired it in to make calls on the collection view -- but now, if I long
press, the element under my finger disappears. As I drag the transparent
image around, the other elements shift - but I can never see the element I
am dragging around. When I let go, there is simply a hole left where I
"dropped" the element.

I do, very much, have a custom layout and I'm not sure that if, for drag, I
need to do anything special. Do I need to calculate the frame of the item I
am dragging around? I'm not sure what to try next except to roll my own
dragging. Any thoughts or things to try?

Thanks in advance.
___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.com<mailto: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<http://lists.apple.com/>

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com

This email sent to luket...@apple.com<mailto: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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UICollectionView Moving

2016-03-07 Thread Luke Hiesterman
I’d check your return value for this method in your layout:

- (UICollectionViewLayoutAttributes 
*)layoutAttributesForInteractivelyMovingItemAtIndexPath:(NSIndexPath 
*)indexPath withTargetPosition:(CGPoint)position NS_AVAILABLE_IOS(9_0);

Luke

On Mar 7, 2016, at 9:55 AM, Luther Baker 
> wrote:

I followed the directions here,
http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/
- to add iOS9 style dragging to my UICollectionView - and it sort of works.

As described in the article, I added a long press gesture recognizer and
wired it in to make calls on the collection view -- but now, if I long
press, the element under my finger disappears. As I drag the transparent
image around, the other elements shift - but I can never see the element I
am dragging around. When I let go, there is simply a hole left where I
"dropped" the element.

I do, very much, have a custom layout and I'm not sure that if, for drag, I
need to do anything special. Do I need to calculate the frame of the item I
am dragging around? I'm not sure what to try next except to roll my own
dragging. Any thoughts or things to try?

Thanks in advance.
___

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

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

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

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

Re: Triggering UITableView's -didSelectRowAtIndexPath: delegate callback

2016-02-28 Thread Luke Hiesterman
It is a general design pattern of all of UIKit - not just UITableView - that 
delegate callbacks for user actions are not triggered when those same actions 
are done programmatically. If you’re going to file a bug, I suggest filing it 
on the entire UIKit design pattern.

Luke

On Feb 27, 2016, at 4:27 PM, Keary Suska 
> wrote:


On Feb 27, 2016, at 3:59 PM, Ben Kennedy 
> wrote:


On 27 Feb 2016, at 11:17 am, Carl Hoefs 
> wrote:

Yes, that works, thanks! I just thought there might be a "preferred" way to do 
it. I guess I was hoping for something like:

[myTableView selectRowAtIndexPath:indexPath
  animated:YES
scrollPosition:UITableViewScrollPositionMiddle
  triggersDelegateCallback:YES];

What gain would that afford you, though?

I believe that the table view API is designed this way to afford the programmer 
control and flexibility. Perhaps your didSelectRow:... implementation calls 
some private method to do the business logic, say -[self fireTheRockets]. In 
that case, you could simply call fireTheRockets directly here instead.

By contrast, the delegate API provides your code a means to act on external 
events (user input) brokered by the table view. Perhaps in such a case there is 
additional UI-related work not suitable for inclusion in fireTheRockets.

This decoupling enables you to separate these concerns.


Except that it doesn’t follow. There is no design necessity that the object 
programmatically setting the selection is the same object as the delegate, nor 
that those two objects know anything about each other. Also if a delegate 
implements such a delegate call it is signaling that it needs to know every 
selection change regardless of how it is accomplished (since it has not way of 
knowing in advance how it was accomplished, unless you decide to couple the two 
objects). This results in a much more reliable and extensible decoupling since 
no other object should know those internal signaling mechanics and should have 
confidence that any other object interested in the selection will be dutifully 
notified. In fact, this is how NSTableView works. Why UITableView doesn’t, 
seems worthy of a radar.

Best,

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


___

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

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

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

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

Re: UICollectionView not obeying zIndex of UICollectionViewLayoutAttributes

2015-08-06 Thread Luke Hiesterman
Can you post your implementations -layoutAttributesForElementsInRect: as well 
as -layoutAttributesForItemAtIndexPath:?

Luke

 On Aug 6, 2015, at 8:09 AM, Ted Bradley earlte...@googlemail.com wrote:
 
 The effect I'm trying to achieve is a kind of sticky header cell. It's 
 important to me that the sticky cell floats over the top of the others. 
 Something a bit like this:
 
   ┌──┐ 
   │  │ 
   │  Cell 0  │ 
   │  ├┐
   └┬─┘│
│  Cell 4  │
│  │
└──┘
┌──┐
│  │
│  Cell 5  │
│  │
└──┘
┌──┐
│  │
│  Cell 6  │
│  │
└──┘
 Cell 4, 5 and 6 would normally viewable and I'm constructing the attributes 
 for cell 0 in my UICollectionViewFlowLayout subclass during 
 layoutAttributesForElementsInRect:. All I do is call the super 
 implementation, determine which cell I need to add in and then construct the 
 UICollectionViewLayoutAttributes(forCellWithIndexPath:). I then set the 
 zIndex for it to 1 (default is `0`).
 
 The problem I'm getting is that the UICollectionView seems to always ignore 
 the `zIndex`
 
   ┌──┐ 
   │  │ 
   │  Cell 0  │ 
   │┌─┴┐
   └┤  │
│  Cell 4  │
│  │
└──┘
┌──┐
│  │
│  Cell 5  │
│  │
└──┘
┌──┐
│  │
│  Cell 6  │
│  │
└──┘
 
 Now I believe it's possible to visually sort this out using a 3d transform, 
 but that doesn't work for me as I don't want any taps going to the cell which 
 is over the top. So in this example I don't want Cell 4 receiving taps 
 intended for Cell 0.
 
 Does anyone have any ideas? This is on iOS 8.4.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UICollectionView parallax-like horizontal scrolling

2014-10-16 Thread Luke Hiesterman
There are multiple ways to skin this cat. One is to use two collection views 
and just modify the content offset of one of them in response to the scrolling 
of the other. 

The behavior can also be built into a layout if you want to use a single scroll 
view. You don’t need different types of cells - you just need your layout to 
make a choice about how it wants each index path to behave. As an example, I 
might create a two column layout where all the even numbered indexes are on the 
left and all the odd numbered indexes are on the right. Or maybe it would be 
something different than that - maybe the first section would go on the left 
and the second section would go on the right. Could be anything. Then if I 
decided I want the right column to scroll faster than normal to create the 
parallax effect, I would return YES from 
-shouldInvalidateLayoutForBoundsChange: and then modify the positions of the 
layout attributes for all the items in the right hand column based on some math 
relative to the content offset. This would accomplish updating the frames of 
the right hand column cells every frame that a scroll occurs and achieve the 
parallax effect.

Luke

 On Oct 15, 2014, at 10:01 PM, Mazzaroth M. taomaili...@gmail.com wrote:
 
 In the running apps view(double-tap Home button) there are two rows each
 which contain two different types of cells. How would one implement this
 using UICollectionView?
 
 I more or less want to do this where the lower row cells are slightly
 narrower than the upper row such that when you swipe to scroll, the items
 in both rows are centred on the screen at the same time but because the
 items in row 1 are slightly narrower, they will scroll slightly faster than
 the items in row 0 creating a parallax-like effect. An extreme example of
 this would be
 
 https://github.com/allaboutapps/A3ParallaxScrollView
 
 in the tree example, however this is done with a custom UIScrollView
 subclass.
 
 And so, I know that this is possible but not sure if I can do it with
 UICollectionView and may need to use UIScrollView instead(however would
 prefer to figure it out with UICollectionView).
 
 In my attempts for UICollectionView, I was thinking that I'd need to use
 one type of cell for row 0 and another type of cell for row 1, but it's not
 clear to me how to specify a different layout for each of the rows, which
 appears to be what I need to do.
 
 Any thoughts on this?
 
 maz
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Animating UICollectionViewCell selection

2014-06-23 Thread Luke Hiesterman
Collection view will call setSelected: on the cell inside an animation block if 
the selection is an animated one. A selection from a touch is not animated, but 
a programmatic selection which does [collectionView selectItemAtIndexPath:path 
animated:YES scrollPosition:scrollPosition] will result in setSelected: being 
called in animation block.

Luke

On Jun 23, 2014, at 4:00 PM, Rick Mann rm...@latencyzero.com wrote:

 Why is there no -[UICollectionViewCell setSelected:animated]? UITableViewCell 
 has this.
 
 But the real problem seems to be that when iOS is handling UICollectionView 
 cell selection, it doesn't set selected on a cell inside an animation block.
 
 Since I don't to participate in the cell-selection process, what's the best 
 way to solve this?
 
 TIA,
 
 -- 
 Rick
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UITableView's tableFooterView and autolayout

2014-06-11 Thread Luke Hiesterman
You have to set the frame yourself (before assigning to the 
tableView.tableFooterView) property. You can use autolayout and 
systemSizeFittingSize to get the appropriate size, but you have to apply it 
yourself.

Luke

On Jun 11, 2014, at 11:16 AM, Torsten Curdt tcu...@vafer.org wrote:

 My question really isn't about positioning.
 
 Given that the tableview scrolls vertically the width should give the
 horizontal width constraint for the footer view. The height of the
 footer should come from the intrinsic size of the footer view. At
 least that's how I image it should work.
 
 Now the question is if that's possible or not. And if not - how people
 are dealing with this.
 
 Thanks for your solution, Sebastian!
 
 ...but the question is whether this is possible without manually
 adjusting the frame.
 
 cheers,
 Torsten
 
 
 
 On Wed, Jun 11, 2014 at 6:21 PM, Sebastian Celis
 li...@sebastiancelis.com wrote:
 On Jun 11, 2014, at 9:41 AM, Torsten Curdt tcu...@vafer.org wrote:
 
 Thanks but there you are setting the frame yourself. The idea was to
 use constraints. Usually you would pin them to the superview. But in
 this case...
 
 My solution uses Auto Layout constraints to get the appropriate size for the 
 header view using systemLayoutSizeFittingSize. Given how UITableViews work 
 when coupled with Auto Layout I believe you do have to set the frame 
 yourself but you can determine what the frame should be using Auto Layout 
 constraints.
 
 You can not use Auto Layout to *position* the header or footer view, but you 
 can use Auto Layout to layout any views within that header or footer. If I 
 understand your original situation, you probably want to use a UIView 
 container for your label and then position that label within its container 
 using Auto Layout.
 
 - Sebastian
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UICollectionViewCell and UIScrollView and autolayout

2014-05-26 Thread Luke Hiesterman
Why is autolayout assigning a frame to the cell? Are you putting autolayout 
constraints on your cell? If so, shouldn’t be. The collection view assigns the 
cell’s frame (according to the wishes of the assigned collectionViewLayout). 
Setting the frame yourself, either by calling -setFrame or something that will 
affect frame on your behalf, such as using autolayout constraints, or 
autoresizing masks on the cell is unsupported.

Luke

On May 26, 2014, at 8:00 AM, Torsten Curdt 
tcu...@vafer.orgmailto:tcu...@vafer.org wrote:

autolayout has assigned a frame to the cell

___

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

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

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

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

Re: UICollectionViewCell and UIScrollView and autolayout

2014-05-26 Thread Luke Hiesterman
That is fine, but the statement made in your original email said “autolayout 
has assigned a frame to the cell.” You’re free to use autolayout inside the 
content view - just don’t try to layout the cell itself.

Luke

On May 26, 2014, at 9:07 AM, Torsten Curdt 
tcu...@vafer.orgmailto:tcu...@vafer.org wrote:

I am not assigning a frame - but I am indeed assigning constraints to
the subviews of the UICollectionViewCell's content view:

https://github.com/tcurdt/paging-and-zooming/blob/master/Paging/TCPagingView.m#L17

That is not supported?

cheers,
Torsten

On Mon, May 26, 2014 at 5:59 PM, Luke Hiesterman luket...@apple.com wrote:
Why is autolayout assigning a frame to the cell? Are you putting autolayout
constraints on your cell? If so, shouldn’t be. The collection view assigns
the cell’s frame (according to the wishes of the assigned
collectionViewLayout). Setting the frame yourself, either by calling
-setFrame or something that will affect frame on your behalf, such as using
autolayout constraints, or autoresizing masks on the cell is unsupported.

Luke

On May 26, 2014, at 8:00 AM, Torsten Curdt tcu...@vafer.org wrote:

autolayout has assigned a frame to the cell



___

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

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

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

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

Re: -hitTest:withEvent: called twice?

2014-02-10 Thread Luke Hiesterman
Yes, it’s normal. The system may tweak the point being hit tested between the 
calls. Since hitTest should be a pure function with no side-effects, this 
should be fine.

Luke

On Feb 10, 2014, at 2:50 PM, Rick Mann rm...@latencyzero.com wrote:

 I'm seeing -hitTest:withEvent: called twice for a single touch. The stack is 
 different between the two. Is it normal for a single view to be hit-tested 
 twice?
 
 Thanks,
 
 -- 
 Rick
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Grouped table view appearance in iOS 7

2013-09-22 Thread Luke Hiesterman
You'd have to implement a custom backgroundView and selectedBackgroundView with 
rounded lines to get that look. Assuming you're talking about Settings on iPad. 

Luke 

 On Sep 22, 2013, at 1:27 PM, Rick Mann rm...@latencyzero.com wrote:
 
 Has anyone figured out how to get the grouped table view appearance in iOS 7 
 exhibited by the Settings app?
 
 -- 
 Rick
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UITableCellView width decreases when scrolling

2013-04-14 Thread Luke Hiesterman
I wouldn't put too much stock in the link you reference. Many of the statements 
made are simply wrong, and there are better strategies.

In general, if you want to put custom stuff in a cell, you should do it by 
adding views - like labels, image views, etc. Only if you find a scrolling 
performance problem and only if via profiling analysis you can show that the 
performance problem is related to having too many views should you think about 
flattening the view hierarchy by using -drawRect.

If you stick to this strategy your life will likely be much simpler.

But, if you do end up deciding you need to flatten the view hierarchy, the much 
simpler way to do it is to create a view which implements -setHighlighted: and 
-isHighlighted add that view to the content. In reference to the problem about 
chevrons you mentioned before, you'll either need to make your view smart 
enough to handle drawing in a shortened-bounds situation, or just make the 
thing always be short (if it's 300 points in width regardless of whether the 
content view is 300 or 320, you don't have a problem). Then in your 
setHighlighted: method, you should cause your view to be redrawn in the 
appropriate way for highlighting (white text and whatever other changes you'd 
need). UITableViewCell will call setHighlighted: on your view at the 
appropriate time and there's no need to setup custom animation hooey.

Luke

On Apr 14, 2013, at 8:43 PM, Koen van der Drift 
koenvanderdr...@gmail.commailto:koenvanderdr...@gmail.com
 wrote:

I'm using a custom UITableCellView, with a UIView where I do all the drawing as 
a subView of the contentView, more or less following the tutorial on this page: 
http://giorgiocalderolla.com/blog.html#customizing-uitableviewcells-a-better-way

I noticed that when I scroll the table, at one point the width of the 
contentView decreases from 320 to 300, and that messes up the drawing I do 
inside the view.  What I figured out so far is that this happens when the 
cell's accessory is set to UITableViewCellAccessoryDisclosureIndicator. When it 
is set to UITableViewCellAccessoryNone, the width stays at 320, and the drawing 
is fine. But I'd like to have the disclosure button. The style of the cell is 
UITableViewCellStyleDefault.

Any ideas or suggestions?

Thanks,

- Koen.



___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

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

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


Re: Design Guidance

2013-03-23 Thread Luke Hiesterman
I preach option 1. I don't know what the adoption rate of iOS 6 is these days, 
but it was 60% of all iPhones within two weeks of launch*, I'd venture it's 
around 90+% nowadays. Moreover I think the set of people who don't update their 
OS probably has a decent percentage of people who won't update to the new 
version of your app either…..so I don't feel like you're losing a lot by 
standardizing on iOS 6.

Luke

On Mar 23, 2013, at 11:29 AM, koko k...@highrolls.net
 wrote:

 … or maybe Divine Guidance.
 
 
 I have an iPad project that requires a collection view and since 
 UICollectionView et al is iOS 6 …
 
 1. Use UICollectionView and abandon iOS 5 users
 2. Use som iOS 5 collection view (what might that be?)
 
 -koko
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Design Guidance

2013-03-23 Thread Luke Hiesterman
The asterisk is there because I meant to cite my source: 
http://www.zdnet.com/60-percent-of-iphones-now-running-ios-6-report-705169/

Luke

On Mar 23, 2013, at 11:35 AM, Luke the Hiesterman luket...@apple.com
 wrote:

 I preach option 1. I don't know what the adoption rate of iOS 6 is these 
 days, but it was 60% of all iPhones within two weeks of launch*, I'd venture 
 it's around 90+% nowadays. Moreover I think the set of people who don't 
 update their OS probably has a decent percentage of people who won't update 
 to the new version of your app either…..so I don't feel like you're losing a 
 lot by standardizing on iOS 6.
 
 Luke
 
 On Mar 23, 2013, at 11:29 AM, koko k...@highrolls.net
 wrote:
 
 … or maybe Divine Guidance.
 
 
 I have an iPad project that requires a collection view and since 
 UICollectionView et al is iOS 6 …
 
 1. Use UICollectionView and abandon iOS 5 users
 2. Use som iOS 5 collection view (what might that be?)
 
 -koko
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: UITableView disabled scrolling Cell selection

2013-03-11 Thread Luke Hiesterman
If you want the behavior of a series of buttons, I'd have a series of buttons. 
Table view cells simply don't behave like buttons. If it makes it easier for 
you, it might make sense to put buttons inside table view cells. 

Luke

On Mar 11, 2013, at 4:38 AM, Ben southwestmons...@googlemail.com wrote:

 Hi, 
 
 I have a UITableView which I have disabled scrolling on.
 
 When a user touches a cell it is selected as required, however when a user 
 touches, drags then releases (on that same cell) no selection of the cell 
 happens.
 
 I understand that in normal use this would be the correct behaviour(as a 
 touches +drag would invoke scrolling), however because I have disabled 
 scrolling this behaviour is not required.
 
 How would I go about selecting a cell after a touches +drag has occurred on 
 the same cell? 
 
 The reason I want this behaviour is because, to a user who has unsteady 
 fingers, it seems like the cell 'button' is broke. 
 
 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:
 https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Map and Contacts Icons on iOS?

2013-02-01 Thread Luke Hiesterman
Nope.

Luke

On Feb 1, 2013, at 5:15 AM, Dave d...@looktowindward.com
 wrote:

 Hi All,
 
 On iOS, is it possible to grab the Icons/Images for the Map and Contacts Apps 
 somehow from the OS?
 
 Thanks a lot
 Dave
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Map and Contacts Icons on iOS?

2013-02-01 Thread Luke Hiesterman
Please don't do that. Apple owns its artwork - it's not for you to take at will 
unless we explicitly provide it for use via API. Besides, you can't expect what 
you take from one release to make sense on the next release. The iPod app was 
split out into the Music and Videos apps, each with different icons. The 
calculator app changed its icon. The Youtube app went away entirely. It's just 
not a good idea.

Luke

On Feb 1, 2013, at 9:11 AM, Alex Zavatone z...@mac.com
 wrote:

 Yup. You can pull them from the simulator, then pass the PNG files through an 
 open source converter to remove Apple's PNG munging. 
 
 If you have the app, you can get the images.
 
 Sent from my iPhone
 
 On Feb 1, 2013, at 12:01 PM, Luke Hiesterman luket...@apple.com wrote:
 
 Nope.
 
 Luke
 
 On Feb 1, 2013, at 5:15 AM, Dave d...@looktowindward.com
 wrote:
 
 Hi All,
 
 On iOS, is it possible to grab the Icons/Images for the Map and Contacts 
 Apps somehow from the OS?
 
 Thanks a lot
 Dave
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
 https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
 
 This email sent to z...@mac.com


___

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

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

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

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


Re: touch position for UITableView

2012-12-20 Thread Luke Hiesterman
You're best off using a UIGestureRecognizer to track the touches. You can 
probably wire up a stock UILongPressGestureRecognizer to do what you need. 
Otherwise you can always write a custom recognizer that just tracks touches. 
Just make sure it does not prevent recognition of other gestures.

Luke

On Dec 20, 2012, at 10:40 AM, Eric E. Dolecki edole...@gmail.com
 wrote:

 Greetings all,
 
 I have the need for getting the touch position for a UITableView. I
 subclassed UITableView and override the touches methods. Like so:
 
 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
 
[self.nextResponder touchesBegan:touches withEvent:event];
 
[super touchesBegan:touches withEvent:event];
 
 }
 
 
 I do this for moved, ended and cancelled. Began works, Moved only fires
 once when the UITableView is being scrolled up or down (if you touch
 horizontally along a cell it keeps firing), and I don't get Ended.
 
 
 How can I best tackle this problem? If I could put a UIView above the
 UITableView and have it report it's touch position normally and then
 somehow pass the events into the UITableView below, that's cool with me - I
 just don't know how to do that. In fact, I'd prefer this approach.
 
 
 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:
 https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: touch position for UITableView

2012-12-20 Thread Luke Hiesterman
-[UIGestureRecognizer locationInView:] will give you the touch location.

Luke

On Dec 20, 2012, at 11:00 AM, Eric E. Dolecki edole...@gmail.com
 wrote:

 I need to continually get the touch point though... In essence I'd like to 
 place a UIImageView (of a touch ring) above everything, drive it (move it 
 around) with touch while maintaining normal operation of the UITableView. 
 
 
 
   Google Voice: (508) 656-0622
   Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
   Imagineric
 
 
 On Thu, Dec 20, 2012 at 1:55 PM, Luke Hiesterman luket...@apple.com wrote:
 You're best off using a UIGestureRecognizer to track the touches. You can 
 probably wire up a stock UILongPressGestureRecognizer to do what you need. 
 Otherwise you can always write a custom recognizer that just tracks touches. 
 Just make sure it does not prevent recognition of other gestures.
 
 Luke
 
 On Dec 20, 2012, at 10:40 AM, Eric E. Dolecki edole...@gmail.com
  wrote:
 
  Greetings all,
 
  I have the need for getting the touch position for a UITableView. I
  subclassed UITableView and override the touches methods. Like so:
 
  - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
 
 [self.nextResponder touchesBegan:touches withEvent:event];
 
 [super touchesBegan:touches withEvent:event];
 
  }
 
 
  I do this for moved, ended and cancelled. Began works, Moved only fires
  once when the UITableView is being scrolled up or down (if you touch
  horizontally along a cell it keeps firing), and I don't get Ended.
 
 
  How can I best tackle this problem? If I could put a UIView above the
  UITableView and have it report it's touch position normally and then
  somehow pass the events into the UITableView below, that's cool with me - I
  just don't know how to do that. In fact, I'd prefer this approach.
 
 
  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:
  https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: touch position for UITableView

2012-12-20 Thread Luke Hiesterman
You can call the method at any time, but you'd probably just call it from your 
gesture handler which will fire for UIGestureRecognizerStateChanged as the 
touch moves. I'd suggest reading up on UIGestureRecognizer. It's a valuable 
class. Event Handling Guide for iOS: Gesture Recognizers

Luke

On Dec 20, 2012, at 11:28 AM, Eric E. Dolecki edole...@gmail.com
 wrote:

 over time though or only when it's triggered? 
 
 
 
   Google Voice: (508) 656-0622
   Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
   Imagineric
 
 
 On Thu, Dec 20, 2012 at 2:02 PM, Luke Hiesterman luket...@apple.com wrote:
 -[UIGestureRecognizer locationInView:] will give you the touch location.
 
 Luke
 
 On Dec 20, 2012, at 11:00 AM, Eric E. Dolecki edole...@gmail.com
  wrote:
 
 I need to continually get the touch point though... In essence I'd like to 
 place a UIImageView (of a touch ring) above everything, drive it (move it 
 around) with touch while maintaining normal operation of the UITableView. 
 
 
 
   Google Voice: (508) 656-0622
   Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
   Imagineric
 
 
 On Thu, Dec 20, 2012 at 1:55 PM, Luke Hiesterman luket...@apple.com wrote:
 You're best off using a UIGestureRecognizer to track the touches. You can 
 probably wire up a stock UILongPressGestureRecognizer to do what you need. 
 Otherwise you can always write a custom recognizer that just tracks touches. 
 Just make sure it does not prevent recognition of other gestures.
 
 Luke
 
 On Dec 20, 2012, at 10:40 AM, Eric E. Dolecki edole...@gmail.com
  wrote:
 
  Greetings all,
 
  I have the need for getting the touch position for a UITableView. I
  subclassed UITableView and override the touches methods. Like so:
 
  - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
 
 [self.nextResponder touchesBegan:touches withEvent:event];
 
 [super touchesBegan:touches withEvent:event];
 
  }
 
 
  I do this for moved, ended and cancelled. Began works, Moved only fires
  once when the UITableView is being scrolled up or down (if you touch
  horizontally along a cell it keeps firing), and I don't get Ended.
 
 
  How can I best tackle this problem? If I could put a UIView above the
  UITableView and have it report it's touch position normally and then
  somehow pass the events into the UITableView below, that's cool with me - I
  just don't know how to do that. In fact, I'd prefer this approach.
 
 
  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:
  https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: FileWrapper iCloud

2012-11-10 Thread Luke Hiesterman
File wrappers don't make it inherently easier or harder to deal with iCloud. 
File packages (which you would use file wrappers to represent) can be elegant 
means of wrapping up document data because it allows for easy separation of 
distinct components, and are usually recommended if they at all make sense for 
your application.

There's some discussion about when it makes sense to use file packages in the 
WWDC session:

http://developer.apple.com/itunes/?destination=adc.apple.com.16351493766

Luke

On Nov 10, 2012, at 9:00 AM, Brad Stone 
cocoa-...@softraph.commailto:cocoa-...@softraph.com wrote:

Does fileWrapper functionality make it easier or harder or is completely 
irrelevant for iCloud document functionality?  My app used to need the 
fileWrapper functionality and it's still in there but I don't need it anymore 
and I want to remove it all.  Would it help me keep it?

Thanks
___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com

This email sent to luket...@apple.commailto: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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Coordinating animation of layers with a UIView animation

2012-11-06 Thread Luke Hiesterman
After setting up your UIView animation, you can introspect the animation timing 
by looking at the respective view's layer.animations. Your can then apply that 
animation to your sublayer. 

For bonus points, just start using a subview instead of a sublayer :)

Luke

On Nov 6, 2012, at 5:09 AM, Roland King r...@rols.org wrote:

 I have a UIView which frame I am animating to a new location/size using [ 
 UIView animateWithDuration:animations ]. The view's layer has a custom 
 sublayer which it's laying out either in layoutSubviews or 
 layoutSublayersOfLayer:, either seems to work. That sublayer is also moving 
 to a new position depending on the new UIView bounds. What I want is the two 
 animations to go together, using whatever the duration set in the UIView's 
 animateWithDuration:animations: call because that is the point at which I 
 know how long the animation needs to be. 
 
 The only way I've found to do this so far seems really hacky, to nest a 
 CATransaction within the UIView animation and give them the same time, is 
 there a better way to accomplish something like this? 
 
NSTimeInterval interval = 2f;

[ UIView animateWithDuration:interval animations:^{
[ CATransaction begin ];
[ CATransaction setAnimationDuration:interval ];
self.faceView.frame=faceViewFrame;
[ CATransaction commit ];
} ];
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: is this possible in iOS with constraints?

2012-11-02 Thread Luke Hiesterman
Cells are sized according to the value returned from heightForRowAtIndexPath:. 
You could theoretically call sizeToFit: on a cell you create inside that method 
to get a height, but it would be very expensive to create a cell for every call 
to this method. One technique you might try is to create a static cell that you 
use for every call to heightForRowAtIndexPath:. You just dump your new label 
contents in there for each row and sizeToFit.

Luke

On Nov 2, 2012, at 8:07 AM, Matt Neuburg m...@tidbits.com wrote:

 Okay, I have this wild and crazy idea. I've got a UITableView with cells that 
 have different heights. The cells' content consists almost entirely of 
 UILabels, and the height of each cell depends on what's going to go into 
 those labels - the cell needs to grow to accommodate the text of the labels. 
 The way I've always done this in the past is to calculate how the labels will 
 be drawn, using NSString sizeWithFont etc, and then lay out the labels and 
 calculate the needed cell size.
 
 But it occurs to me that in theory constraints could do all the work for me. 
 I'm already using constraints to resize the actual labels when the cell 
 changes size to assume its final height, but maybe I could use constraints to 
 *make* cell assume its final height based on the content of the labels. The 
 cell is in a nib, so if there were just one label, the code might be 
 something like this:
 
NSArray* objs = [[UINib nibWithNibName:@Cell bundle:nil] 
 instantiateWithOwner:nil options:nil];
Cell* cell = objs[0];
cell.bounds = CGRectMake(0,0,320,50);
cell.lab.text = // whatever the actual content will be
[cell.lab sizeToFit]; // or something :)
 
 The idea is that the label will assume its final size and the existing 
 constraints will push the cell height larger as needed. Okay, but it isn't 
 working; the cell isn't growing.
 
 My theory is that this probably *can't* work because the auto layout stuff 
 doesn't kick in unless the view is actually in the interface, which (as you 
 can see) it isn't. And probably not until the next run loop, either, which is 
 not good enough; I need to run through a whole lot cells and do this, right 
 now, to calculate all the cell heights in advance of the table appearing.
 
 So, am I right that this is just impossible, or is there some cool way to do 
 it that I just haven't stumbled on yet? Thx - m.
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
 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:
 https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: is this possible in iOS with constraints?

2012-11-02 Thread Luke Hiesterman
UITableViewCell doesn't currently support autolayout, so no, you won't be able 
to have the constraints system calculate the height for you.

Luke

On Nov 2, 2012, at 10:10 AM, Matt Neuburg m...@tidbits.com wrote:

 
 On Nov 2, 2012, at 9:03 AM, Luke Hiesterman luket...@apple.com wrote:
 
 Cells are sized according to the value returned from heightForRowAtIndexPath:
 
 Obviously. And that is why I am calculating (in advance) the value that I 
 will return from heightForRowAtIndexPath:. I've been doing that for years. 
 The question is, though, can I now (iOS 6) have the constraints system 
 somehow calculate that value for me, merely by putting the ultimate values 
 into the labels of a test cell that isn't in the interface?
 
 The code I'm using now is at
 
 https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/ch21p622variableHeights/ch21p622variableHeights/RootViewController.m
 
 As you can see, I'm hard-coding the numbers in my precalc routine 
 (viewDidLoad). Basically, I'm *guessing* what the constraints *will* do when 
 I later give the cell height (using heightForRowAtIndexPath:) and the label 
 resizes because of the constraints. What I'm saying is, how about if I 
 perform the precalculation the opposite way, i.e. by resizing the label and 
 letting it resize the cell? But I can't find a formula to do that. The code 
 below (in this email) shows the sort of thing I've tried. m.
 
 
 On Nov 2, 2012, at 8:07 AM, Matt Neuburg m...@tidbits.com wrote:
 
 Okay, I have this wild and crazy idea. I've got a UITableView with cells 
 that have different heights. The cells' content consists almost entirely of 
 UILabels, and the height of each cell depends on what's going to go into 
 those labels - the cell needs to grow to accommodate the text of the 
 labels. The way I've always done this in the past is to calculate how the 
 labels will be drawn, using NSString sizeWithFont etc, and then lay out the 
 labels and calculate the needed cell size.
 
 But it occurs to me that in theory constraints could do all the work for 
 me. I'm already using constraints to resize the actual labels when the cell 
 changes size to assume its final height, but maybe I could use constraints 
 to *make* cell assume its final height based on the content of the labels. 
 The cell is in a nib, so if there were just one label, the code might be 
 something like this:
 
  NSArray* objs = [[UINib nibWithNibName:@Cell bundle:nil] 
 instantiateWithOwner:nil options:nil];
  Cell* cell = objs[0];
  cell.bounds = CGRectMake(0,0,320,50);
  cell.lab.text = // whatever the actual content will be
  [cell.lab sizeToFit]; // or something :)
 
 The idea is that the label will assume its final size and the existing 
 constraints will push the cell height larger as needed. Okay, but it isn't 
 working; the cell isn't growing.
 
 My theory is that this probably *can't* work because the auto layout stuff 
 doesn't kick in unless the view is actually in the interface, which (as you 
 can see) it isn't. And probably not until the next run loop, either, which 
 is not good enough; I need to run through a whole lot cells and do this, 
 right now, to calculate all the cell heights in advance of the table 
 appearing.
 
 So, am I right that this is just impossible, or is there some cool way to 
 do it that I just haven't stumbled on yet? Thx - m.
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
 
 This email sent to luket...@apple.com
 
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: is this possible in iOS with constraints?

2012-11-02 Thread Luke Hiesterman

On Nov 2, 2012, at 10:22 AM, Matt Neuburg m...@tidbits.com
 wrote:

 
 On Nov 2, 2012, at 10:14 AM, Luke Hiesterman luket...@apple.com wrote:
 
 UITableViewCell doesn't currently support autolayout
 
 I guess I'm having a little trouble understanding what that means. I am 
 placing content interface inside the content view of a UITableViewCell and 
 handing constraints to the cell, and autolayout is working perfectly on that 
 content: the content is repositioned when the cell gets wider and narrower 
 (interface rotates) and it is enlarged vertically when the height of the cell 
 is set. So you must be using support in some refined sense that I don't 
 grasp. Can you expand a little? Thx! - m.

Direct attempts to put constraints on direct subviews of the cell will crash, 
and any attempt to put a constraint on the frame of the cell itself wouldn't 
make any sense because a cell is either A. in the table view, in which case 
it's sized by the table view and not constraints, or B. it's not in the view 
hierarchy, in which case the autolayout engine won't do anything for you.

Luke

 
 , so no, you won't be able to have the constraints system calculate the 
 height for you.
 
 Luke
 
 On Nov 2, 2012, at 10:10 AM, Matt Neuburg m...@tidbits.com wrote:
 
 
 On Nov 2, 2012, at 9:03 AM, Luke Hiesterman luket...@apple.com wrote:
 
 Cells are sized according to the value returned from 
 heightForRowAtIndexPath:
 
 Obviously. And that is why I am calculating (in advance) the value that I 
 will return from heightForRowAtIndexPath:. I've been doing that for years. 
 The question is, though, can I now (iOS 6) have the constraints system 
 somehow calculate that value for me, merely by putting the ultimate values 
 into the labels of a test cell that isn't in the interface?
 
 The code I'm using now is at
 
 https://github.com/mattneub/Programming-iOS-Book-Examples/blob/master/ch21p622variableHeights/ch21p622variableHeights/RootViewController.m
 
 As you can see, I'm hard-coding the numbers in my precalc routine 
 (viewDidLoad). Basically, I'm *guessing* what the constraints *will* do 
 when I later give the cell height (using heightForRowAtIndexPath:) and the 
 label resizes because of the constraints. What I'm saying is, how about if 
 I perform the precalculation the opposite way, i.e. by resizing the label 
 and letting it resize the cell? But I can't find a formula to do that. The 
 code below (in this email) shows the sort of thing I've tried. m.
 
 
 On Nov 2, 2012, at 8:07 AM, Matt Neuburg m...@tidbits.com wrote:
 
 Okay, I have this wild and crazy idea. I've got a UITableView with cells 
 that have different heights. The cells' content consists almost entirely 
 of UILabels, and the height of each cell depends on what's going to go 
 into those labels - the cell needs to grow to accommodate the text of the 
 labels. The way I've always done this in the past is to calculate how the 
 labels will be drawn, using NSString sizeWithFont etc, and then lay out 
 the labels and calculate the needed cell size.
 
 But it occurs to me that in theory constraints could do all the work for 
 me. I'm already using constraints to resize the actual labels when the 
 cell changes size to assume its final height, but maybe I could use 
 constraints to *make* cell assume its final height based on the content 
 of the labels. The cell is in a nib, so if there were just one label, the 
 code might be something like this:
 
 NSArray* objs = [[UINib nibWithNibName:@Cell bundle:nil] 
 instantiateWithOwner:nil options:nil];
 Cell* cell = objs[0];
 cell.bounds = CGRectMake(0,0,320,50);
 cell.lab.text = // whatever the actual content will be
 [cell.lab sizeToFit]; // or something :)
 
 The idea is that the label will assume its final size and the existing 
 constraints will push the cell height larger as needed. Okay, but it 
 isn't working; the cell isn't growing.
 
 My theory is that this probably *can't* work because the auto layout 
 stuff doesn't kick in unless the view is actually in the interface, which 
 (as you can see) it isn't. And probably not until the next run loop, 
 either, which is not good enough; I need to run through a whole lot cells 
 and do this, right now, to calculate all the cell heights in advance of 
 the table appearing.
 
 So, am I right that this is just impossible, or is there some cool way to 
 do it that I just haven't stumbled on yet? Thx - m.
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 pantes anthropoi tou eidenai oregontai phusei
 Programming iOS 5! http://shop.oreilly.com/product/0636920023562.do
 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

Re: UIDocument openWithCompletionHandler: called on what thread?

2012-09-03 Thread Luke Hiesterman
The documentation isn't entirely accurate. The completion handler will only be 
executed on the main queue if you call the method on the main queue. In 
general, the completion handler is executed on the same queue that the 
constituent method was called on. 

Luke

On Sep 3, 2012, at 6:29 AM, Roland King r...@rols.org wrote:

 Here's a small snippet from the docs for UIDocument's 
 openWithCompletionHandler:
 
Parameters
completionHandler
A block with code to execute after the open operation concludes. The block 
 returns no value and has one parameter:
success
YES if the open operation succeeds, otherwise NO.
 
The block is invoked on the main queue.
 
 I have a subclass of UIDocument, this is my openWithCompletionHandler 
 override, I need to cache something at the point the document is opened and 
 closed ..
 
-(void)openWithCompletionHandler:(void (^)(BOOL))completionHandler
{
// after the open, recalcuate the topic
[ super openWithCompletionHandler:^(BOOL success){
[ self cacheTopic ];
if( completionHandler )
completionHandler( success );// -- I'm here
} ];
}
 
 
 I'm in the debugger right now at the 'completionHander( success )' call and 
 I'm on Thread 11. That is not the main thread, harder to show but if I type 
 this into LLDB  ..
 
(lldb) p (BOOL)[ NSThread isMainThread ]
(BOOL) $2 = NO
(lldb) 
 
 Is there something entirely braindead I am missing here or should I be on the 
 main queue and thus on the main thread if the documentation is correct? 
 
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Crash with UITableView reloadRowsAtIndexPaths:withRowAnimation:

2012-08-22 Thread Luke Hiesterman
You need to read the actual exception message. It's almost certainly telling 
you that the number of rows in the dataSource is different than what's expected 
based on the updates you've made. 

Luke

On Aug 21, 2012, at 11:49 PM, Laurent Daudelin laur...@nemesys-soft.com 
wrote:

 iOS 5.0 simulator or device.
 
 When I call this method like this:
[[NSOperationQueue mainQueue] addOperationWithBlock:^{
[self.tableView reloadRowsAtIndexPaths:[NSArray 
 arrayWithObjects:
[NSIndexPath 
 indexPathForRow:0 inSection:0],
[NSIndexPath 
 indexPathForRow:1 inSection:0],
[NSIndexPath 
 indexPathForRow:2 inSection:0],
[NSIndexPath 
 indexPathForRow:3 inSection:0],
nil]
  
 withRowAnimation:UITableViewRowAnimationNone];
}];
 
 the app crashes with a SIGTRAP:
 2012-08-21 23:48:05.173 Erodr[15594:c07] *** Assertion failure in 
 -[UITableView _endCellAnimationsWithContext:], 
 /SourceCache/UIKit_Sim/UIKit-1912.3/UITableView.m:1046
 
 However, if I send the same tableview reloadData, then all is fine.
 
 What's wrong with my reloadRowsAtIndexPath:withRowAnimations:?
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelinhttp://www.nemesys-soft.com/
 Logiciels Nemesys Softwarelaur...@nemesys-soft.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Profound UITableView rendering-performance problem, but only at certain positions?

2012-07-23 Thread Luke Hiesterman

On Jul 23, 2012, at 2:03 PM, Gavin Stokes wrote:

On Mon, Jul 23, 2012 at 8:16 AM, Fritz Anderson 
fri...@manoverboard.orgmailto:fri...@manoverboard.orgwrote:

I think the first problem you should concentrate on should be the
multiply-overlaid drawings. It's hard to tell what's going on unless you
share some code, or at least your design, so I can only ask general
questions.


Thanks for your response.  The code is quite simple, so I'm happy to
provide it.  But, because the occurrence of the problem depends entirely on
the existence of a partially exposed row in a previous section at the top
of the screen, I don't think any of this processing has anything to do with
the problem.  There's only about a 50-pixel danger zone of scroll position
where it occurs, and that zone moves with row height, but not by any
discernible pattern.

I have Location Services set to give me heading updates every 10 degrees.
When my view controller gets called with a heading update, I do:

[self.stashTableView reloadRowsAtIndexPaths:[self.stashTableView
indexPathsForVisibleRows] withRowAnimation:UITableViewRowAnimationNone];

Though probably off topic, this is unnecessary work. If you just want to change 
where your arrow is pointing, you should reach into the cells and change the 
position of the arrow - you shouldn't be doing a reload for that. Think 
something more like for (UITableViewCell* cell in [tableView visibleCells]) 
{cell.thumbImageView.transform = TRANSFORM_CALCULATION;}

Luke


When the tableview calls me with willDisplayCell, and I do a bit of math to
combine the current heading with the angle toward a point of interest.
Then I tell the cell to rotate the arrow image, which is simply a
UIImageView:

CGAffineTransform rotation = CGAffineTransformMakeRotation(degrees * (M_PI
/ 180));

[self.thumbImageView setTransform:rotation];

That's it.  Works great except for a very limited range of scroll offsets.
___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

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

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


Re: Profound UITableView rendering-performance problem, but only at certain positions?

2012-07-23 Thread Luke Hiesterman

On Jul 23, 2012, at 4:34 PM, Gavin Stokes wrote:

Though probably off topic, this is unnecessary work. If you just want to change 
where your arrow is pointing, you should reach into the cells and change the 
position of the arrow - you shouldn't be doing a reload for that. Think 
something more like for (UITableViewCell* cell in [tableView visibleCells]) 
{cell.thumbImageView.transform = TRANSFORM_CALCULATION;}

Thanks.  I thought about doing this, but I'd end up doing the same things that 
reloading the cells is (minus one short line of text).  The position of the 
arrow depends on data specific to each row; each row has an angle to a 
different target, which depends on the user's current position.  So every row's 
angle has to be calculated independently; it's not just an offset that changes 
with heading.  I could theoretically save some of the work if the user hasn't 
moved, but there's only a maximum of four rows involved.

I meant you're putting more load on the system by doing this, not necessarily 
that you, the developer, are doing more work. Reaching inside the cells and 
changing something requires far less processing than issuing a reload which, at 
a minimum, must create/dequeue new cells.

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

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


Re: UITableView woes

2012-07-02 Thread Luke Hiesterman
If you want something potentially scrollable, you want a UITextField. And if 
you're using custom sub views then you should also be defining a custom 
UITableViewCell subclass. So yes, time to subclass and write custom stuff.

Luke

On Jul 2, 2012, at 1:49 PM, C.W. Betts wrote:

 I'm trying to write an iOS app that displays sentences in a table, but 
 UITableView cuts them off. Will I need to do a custom UITableViewCell or can 
 I make UITableView behave? I want to either display them on two rows or have 
 a scroll bar to see the rest of the sentence. 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: UIDocument and non-thread-safe Model

2012-05-27 Thread Luke Hiesterman
Yes, in the simple case, you as the client only implement contentsForType: and 
loadFromContents:error:, which are both main thread hooks and you never need to 
worry about threading.

You, the original poster, are correct in your observation that there is no 
support for a synchronous saving model. This is by design. Applications are 
encouraged to support iCloud storage, and in an iCloud world, reads and writes 
can block for indeterminate amounts of time. So, we don't want to encourage 
anyone to build I/O into the main thread.

Luke

On May 27, 2012, at 3:50 PM, Mike Abdullah 
cocoa...@mikeabdullah.netmailto:cocoa...@mikeabdullah.net wrote:

The general idea is that you make some kind of copy of your model's state and 
pass that as the document's content, leaving the background free to write it 
at its leisure.

On 27 May 2012, at 21:35, Manfred Schwind wrote:

Hi,

when using UIDocument, reading and writing the document is done asynchronously 
in a separate thread. But there's one thing I don't understand: how is that 
supposed to be used with non-thread-safe models? In my opinion most 
straight-forward implemented models are _not_ thread-safe.
If you have the common case of a non-thread-safe model - is there an easy way 
to let UIDocument do reading/writing synchronously at the main thread? Or are 
we supposed to serialize every (!) modification of the model in a 
performAsynchronousFileAccessUsingBlock call?

Initially reading the document (triggered by openWithCompletionHandler) is 
usually not a problem. The user can not work with the model before it has been 
loaded. The problems begin when writing the document: the document write 
methods are called asynchronously, so the model is accessed at this time, but 
the user can do things at the same time in parallel through the UI and modify 
the model at the same time as it is saved - a big source for unpredicted 
behaviour, data-loss, crashes ...

The documentation for performAsynchronousFileAccessUsingBlock only mentions 
accessing the document (assuming this means the document's file?). But I 
think serializing the file access is not enough; accessing the in-memory 
model must also be serialized. Or did I miss something?

Regards,
Mani


___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.netmailto:cocoa...@mikeabdullah.net


___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com

This email sent to luket...@apple.commailto: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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: UIDocument and non-thread-safe Model

2012-05-27 Thread Luke Hiesterman
You want to override contentsForType:. That is the main thread hook. This is 
discussed in 
http://developer.apple.com/library/ios/DOCUMENTATION/DataManagement/Conceptual/DocumentBasedAppPGiOS/Introduction/Introduction.html

Luke

On May 27, 2012, at 4:15 PM, Manfred Schwind 
li...@mani.demailto:li...@mani.de wrote:

Interesting. When exactly should the copy be made? When subclassing UIDocument 
the usual methods (writeContents:... or similar) are already called on the 
separate thread. Can I dispatch making the copy on the main thread with 
dispatch_sync(dispatch_get_main_queue(), ...) ?
Is that anywhere discussed in the documentation?

Mani

Am 27.05.2012 um 22:49 schrieb Mike Abdullah:

The general idea is that you make some kind of copy of your model's state and 
pass that as the document's content, leaving the background free to write it 
at its leisure.

On 27 May 2012, at 21:35, Manfred Schwind wrote:

Hi,

when using UIDocument, reading and writing the document is done asynchronously 
in a separate thread. But there's one thing I don't understand: how is that 
supposed to be used with non-thread-safe models? In my opinion most 
straight-forward implemented models are _not_ thread-safe.
If you have the common case of a non-thread-safe model - is there an easy way 
to let UIDocument do reading/writing synchronously at the main thread? Or are 
we supposed to serialize every (!) modification of the model in a 
performAsynchronousFileAccessUsingBlock call?

Initially reading the document (triggered by openWithCompletionHandler) is 
usually not a problem. The user can not work with the model before it has been 
loaded. The problems begin when writing the document: the document write 
methods are called asynchronously, so the model is accessed at this time, but 
the user can do things at the same time in parallel through the UI and modify 
the model at the same time as it is saved - a big source for unpredicted 
behaviour, data-loss, crashes ...

The documentation for performAsynchronousFileAccessUsingBlock only mentions 
accessing the document (assuming this means the document's file?). But I 
think serializing the file access is not enough; accessing the in-memory 
model must also be serialized. Or did I miss something?

Regards,
Mani


___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.netmailto:cocoa...@mikeabdullah.net



___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com

This email sent to luket...@apple.commailto: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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Resizing UITableView will keeping content scrolled to bottom

2012-04-17 Thread Luke Hiesterman
So, attempting to modify both the frame and the contentOffset in the same 
animation is a problem. This has to do with how UIView animations work coupled 
with how UIScrollView works. I'm going to give a lengthy explanation of why 
this doesn't work, but you can skip to the bottom for what should be the 
solution.

First a quick note on how UIView animations work (to make sure we're on the 
same page):

1. When an animatable property is modified within an animation block, UIKit 
sets up an animation on the given view's underlying CALayer object. That 
animation has a fromValue and a toValue which define what we're animating from 
and to. When you set a property, the value you set gets taken as the 
animation's toValue, and whatever was already there gets set as the fromValue. 
Thus, if you have a view whose alpha is 0.0, and you set its alpha to 1.0 in an 
animation block, UIKit sets an alpha animation on the CALayer whose fromValue 
is 0.0 and whose toValue is 1.0. An interesting caveat here is that if you set 
the same property twice in the same turn of the runloop, the animation results 
might not be as you expect, because the fromValue used by UIKit is always the 
model value just before you make the change. Thus if we start with a view whose 
alpha is 0.0 and run this code

[UIView animateWithDuration:0.3 animations:^(void) {
view.alpha = 1.0;

view.alpha = 0.9;
}];

The result will be that the view jumps immediately to alpha 1.0, and then 
animates to 0.9, even though the 1.0 was in the animation block. The second 
animation clobbers the first one and uses the model value set by the first 
animation as its fromValue.

Moving on

2. Frame changes are interesting because a frame is not directly a property of 
a view - it is a derived property of its center, bounds, and transform. When 
you modify a view's frame, you are actually modifying its center and bounds, 
which are each distinctly animatable properties, and UIKit sets up animations 
on the underlying CALayer for each of them.

And we also need to make sure we're on the same page about how scrolling works 
in UIScrollView:

3. The portion of any view that is drawn on screen is defined by its bounds - 
the coordinate space of that view. Normally, a view has a bounds.origin of 0,0 
and a bounds.size equal to its frame.size. A UIScrollView brings new content 
onto the screen, getting the effect of scrolling, but modifying its 
bounds.origin. In fact, contentOffset is really just bounds.origin.

Ok, so bringing this all together

When you change a table view's contentOffset and its frame.size in the same 
animation, you've actually clobbered one of your animations, because both of 
those properties ultimately result in a bounds animation on the underlying 
layer. One is modifying the bounds origin, and the other bounds size, but 
they're both just bounds animations, and just as we saw in the alpha case 
above, the second one will stomp on the first one and use the first one as its 
fromValue. Thus you will see things jump to the first bounds value you set 
and then animate to the second.

And now what should be a solution to the long-winded explanation of the problem:

Instead of changing the frame of a table view to accommodate the keyboard 
coming up, we recommend changing the contentInset. By adding the height of the 
keyboard to the table's contentInset.bottom, you get additional scrolling area 
so things don't get stuck behind the keyboard, but you won't be creating a 
bounds animation in the process. In fact, UITableViewController does this 
automatically for table views that it manages.

Hope that helps.

Luke

On Apr 16, 2012, at 6:27 PM, Rick Mann wrote:

Er, for reference, the view hierarchy is this:

http://latencyzero.com/stuff/ViewHierarchy.png


On Apr 16, 2012, at 18:16 , Rick Mann wrote:


On Apr 16, 2012, at 16:32 , Luke Hiesterman wrote:

You can do this by wrapping the operation in your own animation block. This 
simple code demonstrates doing it on 44 point high rows:

  [UIView animateWithDuration:0.3 animations:^(void) {
  [tableView beginUpdates];
  CGPoint contentOffset = tableView.contentOffset;
  if (contentOffset.y  0) {
  contentOffset.y += 44;
  tableView.contentOffset = contentOffset;
  }
  [tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath 
indexPathForRow:__numRows inSection:0]] 
withRowAnimation:UITableViewRowAnimationAutomatic];
  __numRows++;
  [tableView endUpdates];
  }];

Yeah, this is essentially what I do, but while I can correctly animate the 
frame change alone, if I try to do that AND change contentOffset, it doesn't 
work.

Please see the following videos. For reference, the view hierarchy is this:

http://latencyzero.com/stuff/AdjustingOffset.mov

The parent View is a blue color. The Container view is green. The UITableView 
is pink.

If I do not adjust the content offset (that is, if it gets set to 0.0), you can 
see the views

Re: Resizing UITableView will keeping content scrolled to bottom

2012-04-16 Thread Luke Hiesterman

On Apr 16, 2012, at 4:09 PM, Rick Mann wrote:

Hi. I'm implementing a messaging UI similar to the one found in Messages. In 
that app, when you focus on the input field, the keyboard pops up, and the 
input field scoots up as the keyboard comes up.

The conversation history area resizes to make room, but if you're scrolled to 
the bottom, the bottom of the content remains visible; it scoots up with the 
bottom edge of the conversation frame.

I tried implementing this by animating the content offset by the same amount as 
the frame is resized, but it doesn't work quite right. It seems that my 
UITableView's frame is not being animated to its new position, but rather it 
snaps up there. Note that it resizes as a consequence of the frame bindings, 
and I'm actually resizing the containing view.

Questions:

1) Is there an easier way to pin the contents of a table view to be scrolled to 
the bottom during a resize animation than to also animate the contentOffset?

You can do this by wrapping the operation in your own animation block. This 
simple code demonstrates doing it on 44 point high rows:

[UIView animateWithDuration:0.3 animations:^(void) {
[tableView beginUpdates];
CGPoint contentOffset = tableView.contentOffset;
if (contentOffset.y  0) {
contentOffset.y += 44;
tableView.contentOffset = contentOffset;
}
[tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath 
indexPathForRow:__numRows inSection:0]] 
withRowAnimation:UITableViewRowAnimationAutomatic];
__numRows++;
[tableView endUpdates];
}];


2) When animating a frame change, are subframe re-sizes also animated? It looks 
like they're partly immediately update, then animating.

Any subviews which are resized in the scope of the superview's frame change 
will share the animation, which includes anything that has autoresizing masks. 
You may need to invoke -layoutIfNeeded within your animation block on views who 
defer resizing of their subviews until layout time to capture some things in an 
animation. But that discussion is orthogonal to your stated goal, which can be 
achieved by following the sample I've provided above.

Luke


--
Rick


___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://lists.apple.com

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

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


Re: UITabBars and UITableViews

2012-04-05 Thread Luke Hiesterman
You want to start with a UITabBarController instance, and then make the view 
controller associated with a give tab be a UINavigationController instance. 
That navigation controller's rootViewController will be a 
UITableViewController. Then when you push a new view controller, it will be in 
the navigation controller which is contained by the tab bar controller, and the 
tab bar stays on screen.

Luke


On Apr 5, 2012, at 3:22 PM, Alex Zavatone wrote:

 Hi.  I'm trying to get a GUI with a UITabBar and UITableViews set up.
 
 I've got a UITabView that is programmatically created.
 One of the Tabs displays a UITableView that is also programmatically created.
 
 This UITableView then displays other views when didSelectRowAtIndexPath is 
 called.
 
 Unfortunately, when a table cell is clicked, my tab view goes away and the 
 new table view is displayed.
 
 What I can't get my head around is how to structure the views so that the 
 tabBar stays on the screen.  
 
 Is it as simple as making the UITableViews shorter, or is there some 
 window/view mojo that I'm missing?
 
 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:
 https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: UITableView lazy instantiation question

2012-03-23 Thread Luke Hiesterman
If you use a UITableViewController, the controller automatically creates a 
UITableView instance and sets it to self.view.

Luke

On Mar 23, 2012, at 8:02 AM, Alex Zavatone wrote:

 While working on practice coding exercises last night, I was trying what I 
 thought should be a simple project.  I wanted to acquire some data, assign it 
 as the datasource for a UITableView, then select a value in that, pass off 
 the selected value to a holder of data, then push a new view for another 
 UITableView, acquire data based on the selected value and then display it.
 
 What bent my mind over a stump was that all the examples I had all never 
 seemed to follow Apple's documentation in the creation of UITableView. I've 
 got one empty xib file with a window tied to the App Delegate.  As a result, 
 in my second UITableView, I got a nice empty white screen, until I walked 
 through the TableView Programming Guide for iOS and added this code:
 
 - (void)loadView
 {
   NSLog(@LocationSpecificsViewController); 
   NSLog(@  In loadView);
 
   UITableView *tableView = [[UITableView alloc] initWithFrame:[[UIScreen 
 mainScreen] applicationFrame]
   
   style:UITableViewStylePlain];
   
 Now, this is what I expected to have to do if creating the tableView 
 programatically.  But for the life of me, I can't figure out how all the 
 other examples (that aren't using a storyboard or xib file) are bringing a 
 table into existence merely through lazy instantiation or with the 
 viewController declaration in the application didFinishLaunching portion of 
 the AppDelegate.
 
 I'm expecting that I should look for a UITableView alloc somewhere, but well, 
 that's obviously not the case.  Though the TVC is being created in the 
 AppDelegate, I'm expecting to see a visible declaration of the UITableView, 
 and am not clear how that's happening through lazy instantiation (in 
 Hegarty's example) or in some of the sample files that Apple provides that 
 don't use xibs or storyboards.
 
 What's happening that allows the tableview to appear and operate with only..
 
 - (void)tableView:(UITableView *)tableView 
 didSelectRowAtIndexPath:(NSIndexPath *)indexPath
 - (NSInteger)tableView:(UITableView *)tableView 
 numberOfRowsInSection:(NSInteger)section
 - (UITableViewCell *)tableView:(UITableView *)tableView 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath
 
 ...yet no visible UITableView allocation that I can see?
 
 TIA
 - Alex Zavatone
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: UITableView lazy instantiation question

2012-03-23 Thread Luke Hiesterman
The table view is created in UITableViewController's implementation of 
loadView. If the table view controller was instantiated via 
-initWithNibName:bundled: it will load the table view from the nib. Otherwise 
it will load it with alloc/init. If you were overriding loadView and not 
calling super, you would not get a table view.

Luke

On Mar 23, 2012, at 8:38 AM, Alex Zavatone wrote:

 
 On Mar 23, 2012, at 11:24 AM, Luke Hiesterman wrote:
 
 If you use a UITableViewController, the controller automatically creates a 
 UITableView instance and sets it to self.view.
 
 Do you know when this gets assigned?
 
 Yeah, that's what I did, but I never got a table view until I added those 
 lines.
 
 @interface LocationSpecificsTableViewController : UITableViewController {
 
 - Alex Zavatone
 
 
 


___

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

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

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

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


Re: UIPickerView joy

2012-03-20 Thread Luke Hiesterman
Only the three heights you identified are supported. There isn't special sauce 
for getting around that, though enforcement wasn't always there in the past.

Luke

On Mar 20, 2012, at 1:05 PM, Alex Zavatone wrote:

 I just noticed something lovely in iOS 4.x and UIPickerView related and am 
 looking to confirm with the group
 
 It appears that setting the height of a UIPicker ist verboten.  
 I've run in iOS 4.x and 5.0 in the simulator and on devices and it appears 
 that the height is somewhat fixed - in most cases.
 
 Also, a quick googling brings up this note:
 Also there are 3 valid heights for UIDatePicker (and UIPickerView) 162.0, 
 180.0, and 216.0. If you set a UIPickerView height to anything else you will 
 see the following in the console when debugging on an iOS device.
 
 
 However, on iOS 4.x, it appears that there is some exception to the height in 
 that it can't be set to any of the smaller values.  Is there any special mojo 
 that needs to be done with setting UIPickerView frames?  Must all the 
 CGRectMake values be floats?  
 
 TIA,
 
 - Alex Zavatone
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Paging UITableView

2012-02-18 Thread Luke Hiesterman
Who/what told you that table views can't be in scroll views? It wouldn't play 
nicely with swipe to delete, but iOS generally supports nested scroll views 
(and a table view is just a special scroll view).

Luke

On Feb 18, 2012, at 8:58 PM, R r4eem...@gmail.com wrote:

 I understand that one is not suppose to embed a UITableView in a
 UIScrollView.  I would like the ability to Page (horizontal scroll)
 multiple UITableViews.  Is there a way to do this without using
 UIScrollView?
 
 R
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Custom UIView drawing but can't figure out when/where it's loading

2012-02-14 Thread Luke Hiesterman
-viewDidLoad is a method on UIViewController - it's not something that will get 
called on a UIView. If you have initialization code, you should override the 
default initializer, -initWithFrame:.

Understanding the role of view controllers and views is an important thing to 
have as a foundation for iOS programming. I would suggest reading 

https://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/Introduction/Introduction.html
and
https://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html

Luke

On Feb 14, 2012, at 4:48 PM, William Squires wrote:

 In my sample project, I've got
 
 TestView.h
 TestView.m
 RBTestView.h
 RBTestView.m
 AppDelegate.h
 AppDelegate.m
 ViewController.h
 ViewController.m
 ViewController.xib
 
 AppDelegate loads the view controller and it's xib - confirmed, as the 
 drawRect: method in TestView does its thing (ViewController.xib's view's 
 class is set to TestView). But when I put an NSLog in TestView.m by adding a 
 -(void)viewDidLoad(), it never fires, and neither does the -initWithFrame: 
 method. So what's the correct place to put initialization code for a custom 
 UIView subclass? Or is my installation of Xcode screwed up? An NSLog() placed 
 in ViewController.m in it's viewDidLoad method does fire, which is what I 
 would expect. What stupid little thing am I missing here?
 
 I've also got these files:
 
 UIRBView.h // #imports Graphics.h and Polygon.h
 UIRBView.m
 Graphics.h
 Graphics.m
 Polygon.h
 Polygon.m
 
 UIRBView is the implementation of a custom UIView subclass (also), but it is 
 supposed to create an instance of a Graphics object which is a handy wrapper 
 class I wrote to make handling drawing in a view more like REALbasic. But if 
 I can't get TestView to confirm that it's loading, I don't have a chance of 
 confirming that my UIRBView subclass (RBTestView.h and RBTestView.m) are 
 loading. Help!
 
 RBTestView inherits from UIRBView which inherits from UIView, and TestView 
 inherits from UIView.
 
 When I set the view (in ViewController.xib) to RBTestView instead of 
 TestView, it doesn't crash, but just displays the screen filled with light 
 gray.
 
 FWIW, this is an iOS 5 project with ARC turned on.
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: What causes a UITableViewCell to be deallocated?

2012-01-23 Thread Luke Hiesterman
Think about it simply. A cell gets deallocated just like any other object - 
when its retain count goes to zero. If you're looking for a cell getting 
deallocated on a non-main thread, you're looking for a place release is being 
called on a non-main thread. I would think you could just override the dealloc 
method to help you track this situation in the debugger. Perhaps add an 
NSAssert([NSThread isMainThread], @wups); in there.

Luke

On Jan 23, 2012, at 11:38 AM, Laurent Daudelin wrote:

 Hello.
 
 I'm trying to track a crash in our app where we have a custom UITableView 
 cell that contains a UITextView because we need the ability to display and 
 open links that might be in the text we're displaying in the text view.
 
 The problem is that somehow, the cell is deallocated and WebKit complains 
 that it's been unable to obtain the web lock from a thread other than the 
 main thread or the web thread when it's deallocated. I have reviewed the code 
 and checked all the reload… message we might send to the table view that 
 could cause the deallocation of its cells but all of those calls are executed 
 from the main thread using [[NSOperationQueue mainQueue] 
 addOperationWithBlock:^{…}] so I'm stumped. Are there any other situations 
 where UITableView cells would be deallocated? The view displays and the view 
 isn't unloaded due to memory warning or any other situation.
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://www.nemesys-soft.com/
 Logiciels Nemesys Software
 laur...@nemesys-soft.com
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: NSAssert with format string

2011-11-16 Thread Luke Hiesterman

On Nov 16, 2011, at 11:40 AM, Matt Neuburg wrote:

 Luke:
 
 (1) Thx!
 
 (2) Any memory of when that happened? Just curious, no biggie.

Snow Leopard for OS X. I think iOS 4 in my land.

 
 (3) Want me to file a bug on the docs?

Go for it.

Luke

 
 m.
 
 On Nov 16, 2011, at 11:38 AM, Luke Hiesterman wrote:
 
 Yes, NSAssert now accepts varargs for formatted strings.
 
 Luke
 
 On Nov 16, 2011, at 11:33 AM, Matt Neuburg wrote:
 
 The docs say that NSAssert takes a condition and a string, and if you want 
 a format string you have to use one of NSAssert's relative, such as 
 NSAssert1, according to the number of format specifiers. But 
 experimentation shows that NSAssert(0, @%@, @testing) does work. Are 
 the docs wrong - can I just use format specifiers freely with NSAssert, and 
 not bother with NSAssert1 and so forth? Thx - 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/luketheh%40apple.com
 
 This email sent to luket...@apple.com
 
 
 --
 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


Re: -tableView:accessoryButtonTappedForRowWithIndexPath: Sometimes returns wrong indexPath.row

2011-11-11 Thread Luke Hiesterman

On Nov 11, 2011, at 12:35 PM, Michal L. Wright wrote:

 Hi,
 
 I have a UITableView that has four sections. Sections 0 and 2 have a single 
 row each. Sections 1 and 3 have variable numbers of rows.
 
 Each row in sections 1 and 3 has an accessory view set up by the following 
 lines in -tableView:cellForRowAtIndexPath:
 
   UITableViewCell cell;
   cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
 
 Most of the time, tableView:accessoryButtonTappedForRowWithIndexPath: returns 
 the correct value for indexPath.row, but occasionally it returns the next 
 row. When the problem occurs with the last row, it seems to return an invalid 
 value.
 
 One of the odd things about this problem is that the rows for which incorrect 
 values are returned vary with the point size of the label.text.
 
 tableView:heightForRowAtIndexPath: returns the following value, where 
 mw_fontSize is an NSString for the point size of the label.text:
 
CGFloat rowHeight;
rowHeight = [mw_fontSize floatValue] * 2;
 
 I've tried 2.2 and 2.4 for the multiplier. That changes which rows have the 
 problem for any given point size, but with 7 to 10 rows in a section, and 
 fontSize ranging from 12 to 24, in a variety of fonts, from American 
 Typewriter to Zapfino, I have not found a fontSize-multiplier combination 
 that does not have at least one row showing the problem. (Actually, the font, 
 itself, seems to be irrelevant.)
 
 The rows all show the correct text, and all behave correctly when tapped 
 outside the accessory button. In the Simulator, it's very easy to see the 
 button darken when pressed, so it's quite clear that the wrong value is being 
 returned by tableView:accessoryButtonTappedForRowWithIndexPath:.
 
 The problem occurs with iOS 4.3 and iOS 5.0 simulators for the iPad and 
 iPhone, and with my iPhone 3G running iOS 4.2.1.
 
 A Google search found one person complaining about the same problem, which 
 was not resolved,
 
 So, my questions are:
 
 1. Is this likely to be an iOS bug that I should report?

Certainly sounds like a bug from your description. It never hurts to file, and 
bugs don't get fixed without bug reports.

Luke

 
 2. If not, what am I doing wrong?
 
 3. If so, does anyone know of a workaround?
 
 Thanks,
 -- Mike Wright
 
 
 ___
 
 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/archive%40mail-archive.com

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


Re: Animating a UITableViewCell changing size

2011-10-13 Thread Luke Hiesterman
You should never directly set the frame of a cell that is in the table view. 
Since UITableView automatically requiries and adjusts row heights when you do a 
begin/endUpdates block, performing an empty such block by itself after 
adjusting row heights in your model is sufficient to animate a change. The 
Table View Animations and Gestures sample on developer.apple.com demonstrates 
this technique coupled with a pinch gesture. 

As for the call to reloadRowsAtIndexPaths, that may or may not be appropriate 
depending on what you're doing. If you truly want to get a given row to animate 
to a new height, then you don't want to reload it, because that will create a 
new cell rather than animating the existing one.

In the end, your code could end up looking something like this for animating a 
row height change:

[self updateModelHeightForRowAtIndexPath:indexPath disclosureOpen:YES];
[tableView beginUpdates];
[tableView endUpdates];

Luke

On Oct 13, 2011, at 2:35 AM, Thomas Davie tom.da...@gmail.com wrote:

 Dear list,
 
 I'm trying to construct a UITableViewCell with what is essentially a 
 disclosure triangle on it.  When that's tapped, the cell expands to show 
 additional information.  I currently hack this with code along these lines:
 
NSArray *cellPaths = [tableView indexPathsForVisibleRows];
[UIView animateWithDuration:0.3
 animations:^ ()
 {
 MyCustomCell *cell = [tableView cellForRowAtIndexPath:indexPath];
 NSUInteger minRow = [indexPath row];
 BOOL d = ![cell disclosed];
 [cell setDisclosed:d];
 [disclosures setObject:[NSNumber numberWithBool:d] forKey:[cell 
 statName]];
 for (NSIndexPath *p in cellPaths)
 {
 if ([p row]  minRow)
 {
 MyCustomCell *c = [tableView cellForRowAtIndexPath:p]
 [c setFrame:CGRectMake([c frame].origin.x, d ? [c 
 frame].origin.y + kDisclosureOffset : [c frame].origin.y - kDisclosureOffset, 
 [c frame].size.width, [c frame].size.height)];
 }
 }
 
 }
 completion:^ (BOOL finished)
 {
 [tableView reloadRowsAtIndexPaths:cellPaths 
 withRowAnimation:UITableViewRowAnimationNone];
 }];
 
 This for the most part works well except for one case – collapsing the cells. 
  When this happens, the table view does not have cells for the rows that are 
 not yet visible, but become visible as the cell collapses.  Because of this, 
 a blank area comes into view at the bottom of the table view, and then 
 flashes as it gets replaced by the newly generated rows.
 
 I've tried using cellForRowAtIndexPath: to grab the cells off the bottom, but 
 these come back as nil, as the table view doesn't think it needs to show 
 them.  The only other thing I can conjor in my mind is to call something 
 similar to the data source method directly to construct cells myself, add 
 them to the TV, animate them in, remove them and reload the table view.  
 However, this does not solve one final issue – what happens when the table 
 view is scrolled near to the bottom and there are no cells to add.
 
 If anyone could recommend a good way forward here, I'd be appreciative.
 
 Thanks
 
 Tom Davie
 
 
 ___
 
 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/archive%40mail-archive.com

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


Re: Confused with block completionHandler

2011-08-24 Thread Luke Hiesterman
It looks like you've basically got it with your openPanel example. The only 
difference in the document example is that the parameter to the block is an 
NSError*. So, your call would look something like this:

[self saveToURL:[self fileURL] ofType:@myDocType 
forSaveOperation:NSAutosaveInPlaceOperation completionHandler:^(NSError* error) 
{
if (error) {
// do some error handling
}
else {
// do other work
}
}];

Luke

On Aug 24, 2011, at 5:46 PM, Brad Stone wrote:

 I need to call this method manually but I'm confused how to format the 
 completionHandler.  I don't understand what I'm reading.  Can anyone give me 
 an example of how to define the completionHandler or point me to some 
 documentation?
 
 [self saveToURL:[self fileURL] ofType:@myDocType 
 forSaveOperation:NSAutosaveInPlaceOperation completionHandler:^(I'm 
 confused!!!)];
 
 This is the method definition
 - (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName 
 forSaveOperation:(NSSaveOperationType)saveOperation completionHandler:(void 
 (^)(NSError *errorOrNil))completionHandler
 
 I've used blocks before like below but I don't understand the syntax above 
 and I couldn't find an example on the internet or the documentation.  Any 
 help would be appreciated.
 [openPanel beginSheetModalForWindow:[NSApp keyWindow] 
 completionHandler:^(NSInteger theResult) {
 if (theResult) {
   // some code here
 }
 
 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/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/archive%40mail-archive.com

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


Re: -[UITable indexPathsForRowsInRect:] returning bogus paths?

2011-08-18 Thread Luke Hiesterman
It sounds like you're getting the index path you expect, but you're just 
surprised that cellForRowAtIndexPath: with that index path returns nil when 
it's scrolled out of view. If I'm reading that correctly, then this is correct 
behavior. Note the comment in UITableView.h:

- (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath;
// returns nil if cell is not visible or index path is out of range

Luke

On Aug 18, 2011, at 2:38 PM, Rick Mann wrote:

Xcode 3.2.6, iOS 4.3 (8F190 simulator)

I'm calling -indexPathsForRowsInRect:, which always works correctly if the 
table isn't scrolled. But if the table is scrolled, and the supplied CGRect is 
not necessarily over a row in the table. I still get back what appears to be a 
valid array with a single NSIndexPath, with section and row of 0, 0.

But when I ask the table for the cell at that path, I get back nil (even though 
I know there's a cell there).

Is there something about that path that identifies it as bad? I don't see 
anything in its structure in the debugger.

thanks,

--
Rick

___

Cocoa-dev mailing list 
(Cocoa-dev@lists.apple.commailto: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.comhttp://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/archive%40mail-archive.com

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


Re: Masking UIImages (yes, again)

2011-06-26 Thread Luke Hiesterman


On Jun 26, 2011, at 3:06 PM, James Miller jmiller3...@gmail.com wrote:

 I've been reading and experimenting and browsing and reading and 
 experimenting but mostly failing miserably here and I need to ask the hive 
 mind for some assistance.
 
 In a nutshell, I'm just trying to take a range of white colors out of a 
 UIImage and make those colors transparent. From what I've read, I shouldn't 
 use PNGs with an alpha already defined, but I also shouldn't use JPGs because 
 they don't have an alpha channel.

Where did you read that you shouldn't use PNGs with alpha?

 
 So I've been trying to the extract the UIImage's CGImage and then convert it 
 from RGB to RGBA and THEN mask it with CGImageCreateWithMaskingColors with no 
 success (transparent areas appear as black). I've tried various techniques 
 involving CGBitmapContextCreate and CGImageCreate but with no luck.

Note that if you did successfully make parts of your image transparent, they 
would show up as black if drawn into an opaque context. How are you 
drawing/displaying the image?

Luke

 
 This can't POSSIBLY be as complicated as I'm making this out to be! Can 
 someone please show me how to do this properly!?
 
 A thousand thank yous and a pet herring named after you!
 
 --James
 
 
 
 
 The world is divided into people who do things and people who get the 
 credit. Try, if you can, to belong to the first class. There's far less 
 competition.
 
 ___
 
 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/archive%40mail-archive.com

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


Re: [iOS] What's the point of UISegementedControl.tintColor?

2011-06-15 Thread Luke Hiesterman
If you set it to a color that isn't black, you will be able to see a 
difference. Black behaves this way because selection is shown by making the 
button appear depressed, and therefore darker. You can't get darker than black, 
thus what you see.

Luke

On Jun 15, 2011, at 12:15 PM, Rick Mann wrote:

 When I set this in IB to say, black, the control becomes black, and there's 
 no distinguishing between the selected segment and unselected segments.
 
 What's the point of tintColor?
 
 -- 
 Rick
 
 ___
 
 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/archive%40mail-archive.com

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


Re: Changing UISwitch text

2011-04-29 Thread Luke Hiesterman
Neither of those things are possible with UISwitch. You'd have to write your 
won UIControl subclass.

Luke

On Apr 29, 2011, at 4:29 PM, Jon Sigman wrote:

 Is there a straightforward way to change the text on the UISwitch (ON and 
 OFF) to something else? Alternatively, is there a way for a UIButton to act 
 like a toggle (it stays highlighted until touched again)?
 iOS 4.3
 ___
 
 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/archive%40mail-archive.com

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


Re: UIPickerView

2011-04-25 Thread Luke Hiesterman
You probably want to display 1 picker at a time, with a way for the user to 
navigate from one to the other. See what happens if you go to this page on iOS 
and tap on one of the selection boxes.

http://www.google.com/advanced_search

Luke

On Apr 25, 2011, at 11:47 AM, koko wrote:

 I haven't found sample code (if someone can point me to an example) ...
 
 A current Windows app utilizes three pop up lists for the user to make a 
 selection
 
 List 1 is the macro selection
 List 2 and List 3 refine the selection
 
 The combination of three selections determines an answer.
 
 Now I understand that UIPickerView is the analog for the pop up list.
 
 But, UIPickerView seems to take up lots of real estate so for an iOS app 
 deployed to the iPhone three UIPickerViews seem prohibitive.
 
 What is the proper thing to do 
 
 Display each UIPickerView when a UILabel (for example) is tapped?
 
 Any suggestions or samples much appreciated.
 
 -koko___
 
 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/archive%40mail-archive.com

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


Re: Class UITableViewCellContentView is implemented in both here and there. One of the two will be used. Which one is undefined.

2011-04-08 Thread Luke Hiesterman
It means that UIKit now defines a class called UITableViewCellContentView and 
that collides with one of your classes. Objective C has this inherent weakness 
that if a class with the same name is implemented in more than one place, they 
fight for which one gets used. Since you can't change UIKit, you will have to 
change the name of your class. While you're at it, I'd recommend not prefixing 
your own class names with UI or other apple prefixes such as NS. It will help 
you avoid this situation in the future. 

Luke

On Apr 7, 2011, at 10:50 PM, Laurent Daudelin laur...@nemesys-soft.com wrote:

 Back working on an old project I haven't touched in maybe over a year. 
 Updated the project file with the latest SDK, clean all targets and rebuilt.
 
 Now, when I launch the app in the simulator (any version of iOS), I'm getting 
 this stupid error:
 
 Class UITableViewCellContentView is implemented in both 
 /Users/laurent/Library/Application Support/iPhone 
 Simulator/4.0.2/Applications/EB19DD7A-2905-4625-8120-B6A8432318D7/iOS 
 App.app/iOS App and 
 /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/System/Library/Frameworks/UIKit.framework/UIKit.
  One of the two will be used. Which one is undefined.
 
 I googled the first part of the error and found a few, old references about 
 an old bug that was in the framework but with the recent SDKs still doing it, 
 I don't understand.
 
 What's wrong with this and what am I missing?
 
 Thanks in advance!
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelinhttp://www.nemesys-soft.com/
 Logiciels Nemesys Softwarelaur...@nemesys-soft.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
___

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: Adding subviews to UITableViewCell's contentView and autoresizing behavior

2011-03-03 Thread Luke Hiesterman
Flexible width means change my width if my superview's width changes and 
accessory views cause the contentView to shrink from its original state as the 
full width of the cell (since the contentView must make space for the 
accessoryView). Therefore, your subview auto shrinks with it since you set the 
mask. Make sense?

Luke

On Mar 2, 2011, at 10:39 PM, Ray cocoa-...@deployedsmarts.com wrote:

 Hi! First post to the list, please be gentle ;)
 
 Small question: when I add a subview to the contentView of a UITableViewCell, 
 the rendered width of the subview's frame will be different, depending on 
 whether I set the autoresizingMask in combination with an accessoryView. So, 
 when I set up a clean test project using the usual UITableViewController, 
 make its TableView visible etc. and then use this example code:
 
 - (UITableViewCell *)tableView:(UITableView *)tableView 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 
  static NSString *CellIdentifier = @Cell;
  UIView *testView;
  UITableViewCell *cell = [tableView 
 dequeueReusableCellWithIdentifier:CellIdentifier];
  if (cell == nil) {
  cell = [[[UITableViewCell alloc] 
 initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] 
 autorelease];
 
testView = [[[UIView alloc] initWithFrame:CGRectMake(10.0, 10.0, 
 226.0, 12.0)] autorelease];
// testView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
testView.backgroundColor = [UIColor redColor];
[cell.contentView addSubview:testView];
 
UIView *testHolder = [[[UIView alloc] 
 initWithFrame:CGRectIntegral(CGRectMake(0.0, 0.0, 64.0, 32.0))] autorelease];
testHolder.backgroundColor = [UIColor greenColor];
cell.accessoryView = testHolder;
  }
 
  return cell;
 }
 
 the actual rendered width of the testView will be smaller (in this case 70 
 points I think it was) when I uncomment the UIViewAutoresizingFlexibleWidth 
 bit. There will be no difference when I don't use a cell.accessoryView...
 
 Is this expected behavior? Does it have to do with how the cell layouts its 
 subviews depending on the use of an accessoryView? I couldn't find this in 
 the documentation nor the list archive, so if anyone could enlighten me, much 
 appreciated! I would also be interested in workarounds...
 
 Thanks!
 - Ray.
 
 
 ___
 
 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/archive%40mail-archive.com

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


Re: Adding subviews to UITableViewCell's contentView and autoresizing behavior

2011-03-03 Thread Luke Hiesterman
The strategy I recommend for anyone adding views to UITableViewCell is to 
subclass and implement layoutSubviews. You will then be able to easily set your 
subview frames as you desire for any orientation because layoutSubviews will be 
called on rotation. 

Luke

On Mar 3, 2011, at 8:50 PM, Ray cocoa-...@deployedsmarts.com wrote:

 Flexible width means change my width if my superview's width changes and 
 accessory views cause the contentView to shrink from its original state as 
 the full width of the cell (since the contentView must make space for the 
 accessoryView). Therefore, your subview auto shrinks with it since you set 
 the mask. Make sense?
 
 Luke
 
 Thanks for your fast reply, Luke!
 
 It does makes sense. I wanted to use the autoresizing mask because it 
 supports rotation (of the device) in a nice way for my subview (initially I 
 used an animation to adjust the width of the subview, but I wanted to make 
 things simpler). Because my fixed-width accessoryView will always be there 
 (in my cell's implementation in the real app that is), would you consider it 
 good practice to take into account the offset in defining my subview's width, 
 if you know what I mean?
 
 Thanks,
 - Ray.
 
 ___
 
 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/archive%40mail-archive.com

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


Re: animating addSubview with iOS4

2011-03-01 Thread Luke Hiesterman
You can only animate properties documented as animatable. Try adding your 
subview to its superview with an alpha of 0.0 and then animating the alpha to 
1.0. 

Luke

On Mar 1, 2011, at 8:32 AM, Martin Linklater mslinkla...@gmail.com wrote:

 Hi - I'm having trouble getting Core Animation to animate a UIButton 
 appearing on my parent view. My old code did this:
 
 create button
 [self.view addSubview:newButton];
 
 The button appeared straight away and works fine. Now, I'm trying to animate 
 the appearance of this button and I just can't seem to get it working. 
 Whatever I try the button appears straight away, just like the line above. 
 I've tried numerous snippets of sample code, none of them work. My current 
 code looks like this:
 
 create button
 [UIView transitionWithView:self.view duration:1.0 
 options:UIViewAnimationOptionTransitionCurlUp animations:^{ [self.view 
 addSubview:newButton]; } completion:nil];
 
 I'm obviously doing something wrong here, can anyone point me in the right 
 direction ?
 
 Thanks - I'm new to CA, so please bare with me 
 8).___
 
 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/archive%40mail-archive.com

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


Re: Reusable Cells

2011-02-02 Thread Luke Hiesterman
Welcome to the list and the platform, JD. The purpose of the cell reuse queue 
is so that we don't have to keep creating new cell objects as we scroll a 
table. We take advantage of the fact that as new cells are appearing, old cells 
are disappearing. Rather than throw the old cells away and create new ones, we 
reuse them. We can take advantage of this same principle in other situations 
besides scrolling, such as reloading. 

So, to answer your question of why you enter the if statement more than once, 
it's because each cell on screen is still a unique cell object. Therefore we 
have to create at least as many cells as are on the screen. A cell does not 
enter the reuse queue until it goes off screen, and as long as there is nothing 
in the queue, attempts to dequeue a cell will return nil. If you were to scroll 
your table or reloadData, you would find instances where you did get a valid 
cell out of the queue. 

Luke

Sent from my iPad

On Feb 2, 2011, at 2:42 AM, JD Guzman jdg@me.com wrote:

 Hello,
 
 I'm new to this list and also relatively new to development on the Mac/iPhone 
 platforms.
 
 I was just wondering if someone could clarify how exactly 
 dequeueReusableCellWithIdentifier: works. The reason I ask is because I have 
 the following code:
 
 -
 
 - (UITableViewCell *)tableView:(UITableView *)tableView 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 
UITableViewCell *cell = [channelList 
 dequeueReusableCellWithIdentifier:@channelCell];

if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero 
 reuseIdentifier:@channelCell] autorelease];
}

[[cell textLabel] setText:[channels objectAtIndex:[indexPath row]]];

return cell;
 }
 
 -
 
 Now if I set a break point inside the if statement I was expecting that it 
 would only be entered once, however it is entered every time a cell is 
 created.  Shouldn't the call to dequeueReusableCellWithIdentifier: return a 
 cell after it has been created inside the if statement?  Or am I 
 misunderstanding how this works?
 
 Regards,
 
 JD___
 
 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/archive%40mail-archive.com

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


Re: UITableView: Delay select recognition

2011-01-27 Thread Luke Hiesterman


On Jan 27, 2011, at 7:14 AM, Phillip Mills phillip.mil...@acm.org wrote:

 I would like to have either an action occur that's linked to a double-tap in 
 a UITableViewCell subclass *or* the action specified by the 
 ...didSelectRowAtIndexPath:... method of the owning UITableView, but not 
 both.  I've encountered some problems with each approach I've tried.
 
 - Having the table's select method perform an action after a delay and ask 
 the cell whether it should *really* do it sort of works but is a bit scary 
 since it depends on the length of delay.  (I really don't like things that 
 only function if a timing window is always valid.)
 
 - Obviously, pulling out the table's gesture recognizer and setting up 
 dependencies is a bad idea, mostly because that recognizer isn't documented, 
 but also because it's not the cell that's recognizing its own selection.  
 (Having the table depend on the failure of all its cells sounds overly 
 complex.)

What is this gesture recognizer you speak of pulling out of the table view? 
Table view does not use gestures for selection, but you're right that even if 
it did, you shouldn't mess with it. 

 
 - I had one idea that seemed promising for a while.  Creating both a 
 single-tap and a double-tap recognizer for the cell does prevent the table's 
 select method from being called.  My theory was that perhaps I could use...
[singleTap requireGestureRecognizerToFail:doubleTap];
 ...in the cell and *somehow* trigger the table's select only if the 
 single-tap succeeded.  Unfortunately (and unexpectedly!) putting that 
 dependency on the single-tap stopped it from blocking the table's select.

A single tap by itself would fire before the table gets a chance to process any 
touches. By adding the failure requirement you allow the table to get touch 
events when the gesture doesn't fire immediately. 

 
 At this point, my feeling is that maybe I should handle both single and 
 double taps in the cell -- with the dependency, send a custom notification 
 for the table to use when single succeeds, and do nothing in the table's 
 normal select cell logic.  OTOH, I also feel that this must be a common 
 requirement and therefore easier than I'm making it appear.  (?)

Have you tried just having a double tap gesture and doing everything there? 
Perform one action on the succeed case and another on the failure case. 

 
 ---
 
 ( It would be so much easier to not fight with the framework if the framework 
 was a little less hostile.  I think I'm seeing one violation of the 
 Principle of Least Astonishment for every two hours of work that I do with 
 it.  :) )
 
 ___

___

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

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

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

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


Re: UITableViewCell and accessoryView

2011-01-26 Thread Luke Hiesterman


On Jan 26, 2011, at 6:17 AM, Hrishikesh Murukkathampoondi hris...@gmail.com 
wrote:

 
 
 In a UITableView when a cell is swiped a delete button appears and allows you 
 to delete the row. I want to change this behavior by putting up a different 
 button Complete that will perform a different action.
 
 
 For this I created a UISwipeGestureRecognizer and added it to the 
 UITableViewCell. The swipe handler method modifies the UITableViewCell by 
 setting a button as its accessoryView.
 
 When the user clicks on the complete button I do the right thing (and also 
 dispose off the button).
 
 Question 1:
 Here is where I am stuck. How do I remove the Complete button when the user 
 first swipes and then clicks on some other row or does some other action.
 
 For example in the Mail application if you swipe to delete an email and then 
 touch anywhere else except the delete button the delete button goes away. In 
 my App when the Complete button is displayed  in cell1 and another cell is 
 touched I want to make the complete button disappear in cell1. But how do I 
 get a handle to cell1?
 

You'd have to detect touches any where else. Perhaps a gesture recognized on 
the whole view. 

 
 Question 2:
 Do I really nee to implement a UISwipeGestureRecognizer for my purpose? A 
 UITableViewCell already recognizes swipes. Is there a way to change what it 
 does on a swipe rather than what I have done?

The UITableViewDelegate protocol provides a method for customizing the text of 
the delete button, but there isn't a way to customize the behavior beyond that. 

Luke

 
 
 Thanks
 Hrishi
 
 
 ___
 
 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/archive%40mail-archive.com

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


Re: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread Luke Hiesterman
viewDidLoad is called the first time the view property of the vc is accessed - 
that's when loading happens. There is no guarantee that the view is in a window 
at that time, and presenting a modal vc on a vc whose view is not in a window 
does not make sense. Perhaps viewDidAppear is what you were looking for. Where 
does the documentation say you can do this in viewDidLoad?

Luke

Sent from my iPhone.

On Jan 16, 2011, at 11:33 AM, G S stokest...@gmail.com wrote:

 Hi all.
 
 The Apple doc says this is possible, but it doesn't work when you want
 the second modal view controller presented immediately.  If you
 present a modal view controller that immediately presents another one
 in its viewDidLoad method, the second one never shows up.  No errors
 are reported, so what's going on?
 
 A workaround I've seen people use (which does work) is to have the
 ultimate parent instantiate all of the children's modal views, but
 that requires every parent to determine (in advance) every view
 controller in the hierarchy; obviously that's poor practice.  For
 example, this works:
 
[self presentModalViewController:newPictureController animated:NO];
[self.newPictureController
 presentModalViewController:newPictureController.picker animated:YES];
 
 This makes it impossible to create controllers that manage their own
 modal views upon instantiation.  Should the failure to show a modal
 view controller from viewDidLoad be regarded as a bug in the SDK?
 Anybody have a solution?
 
 Thanks!
 
 Gavin
 ___
 
 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/archive%40mail-archive.com

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


Re: Why can't a modal view controller present another in viewDidLoad?

2011-01-16 Thread Luke Hiesterman
Delayed performance is not appropriate for something like this, because that 
fact that your view was just loaded is not a guarantee that it's about to be 
added to the view hierarchy. Delayed performance should not be used as a 
haphazard crutch because it seems to make a given problem go away. It should 
only be used when the problem and the purpose of the delayed perform are both 
well understood. 

Luke

Sent from my iPad

On Jan 16, 2011, at 6:46 PM, Matt Neuburg m...@tidbits.com wrote:

 On Sun, 16 Jan 2011 13:47:06 -0800, G S stokest...@gmail.com said:
 On Sun, Jan 16, 2011 at 11:47 AM, Luke Hiesterman luket...@apple.com wrote:
 viewDidLoad is called the first time the view property of the vc is 
 accessed - that's when loading happens. There is no guarantee that the view 
 is in a window at that time, and presenting a modal vc on a vc whose view 
 is not in a window does not make sense. Perhaps viewDidAppear is what you 
 were looking for. 
 
 Or just use delayed performance. I use delayed performance a *lot*. Like 
 whipped cream, it covers a multitude of sins. m.
 
 --
 matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
 A fool + a tool + an autorelease pool = cool!
 AppleScript: the Definitive Guide - Second Edition!
 http://www.apeth.net/matt/default.html#applescriptthings___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/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/archive%40mail-archive.com

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


Re: UITableView Custom Section Headers

2010-12-27 Thread Luke Hiesterman


On Dec 27, 2010, at 2:30 AM, ico jche...@gmail.com wrote:

 Hi,
 I don't know if you have figured this out. I also want to know how to do the
 customization
 on the section part of the tableview, not the cell but the section part. I
 want to put some
 custom content including an image on my section header rather than just some
 text.
 
 Can anyone tells me how to do this? Thanks.
 
 2010/8/17 Luis Israel Pasos Peña lpa...@dreamink.com.mx
 
 I was creating an RSS reader that I thought was really cool, but then I saw
 Jason Beaver's and Luke Hiesterman's presentation at WWDC 2010 and I went...
 OK that's cooler.
 
 So basically, I'm stuck with a couple of things in the new version of the
 RSS reader:
 
 1. I'm implementing UIViewControllers as custom section headers, but I
 don't know if this is the best approach. What I'm trying to do is to add an
 Activity indicator , label and a reload button to each header so that the
 user is able to reload a feed directly from each header. Also, the
 allocations of the headers seem to happen every time I scroll through the
 UITableView, I figure this isn't good at all.

You should not be using view controllers for the section headers. Remember that 
view controllers are designed around screenfuls of content - not to manage some 
subview of your table. Therefore you might be using a UITableViewController for 
the current screen, but for implementing your custom headers, all you will be 
doing is creating a custom subclass of UIView. 

As for the allocation problem, feel free to cache your custom header views if 
that makes sense for your application. Then when we ask for the header again, 
you can return the cached version. 

 
 2. I need to retrieve only the feed particular to that specific section and
 then replace it on the tableview. To do this I need the section number. How
 can I get the section from the tap on the section header?

There's more than one way to skin this cat, but in my demo app, I simply 
assigned the section number as a property of the custom header view when I 
created it. That way, when it was tapped it could send a message back to the 
view controller that included its section index. 

 
 I don't know if Luke is still on this list, and I also know this is might
 be too much to ask, but is there anyway we could take a look at the
 TableViewUpdates project, much like Francois Jouaux did with Padalicious?
 Maybe not all of it, just the part related to the headers?
 

This project has been made into sample code on developer.apple.com. 
https://developer.apple.com/library/ios/samplecode/TableViewUpdates/

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


Re: Question about UITableView and loading some XML

2010-09-22 Thread Luke Hiesterman
[tableView reloadData];

Luke

Sent from my iPhone.

On Sep 22, 2010, at 8:20 AM, Eric E. Dolecki edole...@gmail.com wrote:

 I have a view that contains a UITableView. I am loading an XML file and
 parsing it, getting a list of names. I populate a NSMutableArray with those.
 I want to stuff them into the tableview, however the table's delegate
 methods fire before the XML is done, so if I do a [array count] it will be 0
 until the array is filled.
 
 Is there a way to reset the tableView so it will call the delegates again?
 
 
  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/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/archive%40mail-archive.com

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


Re: Relation of UIView layer to drawRect:

2010-08-24 Thread Luke Hiesterman
Adding a sublayer to self.layer works just like adding a subview to self. 
Sublayers are drawn on top of their superlayers. In this case the superlayer is 
your view, so the image in the sublayer will be rendered on top of whatever you 
draw in drawRect:

Luke

Sent from my iPhone.

On Aug 24, 2010, at 8:47 PM, David F. dav...@gmx.us wrote:

 What is the relationship of a UIView's layer (and its sublayers) to what 
 happens when that UIView's drawRect: is called?  I would expect the code 
 below to draw a diagonal line across (i.e. on top of) the image, but it looks 
 like the line is drawn behind the image.  In other words, all I see is the 
 image.
 
 @implementation MyView
 
 - (void)awakeFromNib {
CALayer *imgLayer = [CALayer layer];
imgLayer.position = CGPointMake(self.bounds.size.width / 2, 
 self.bounds.size.height / 2);
imgLayer.bounds = self.bounds;
imgLayer.contents = (id)[[UIImage imageNamed: @myimage.jpg] CGImage];
[self.layer addSublayer: imgLayer];
 }
 
 - (void)drawRect: (CGRect)rect {
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, 0, 0);
CGPathAddLineToPoint(path, NULL, self.bounds.size.width, 
 self.bounds.size.height);
 
CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *black = [UIColor colorWithRed: 0 green: 0 blue: 0 alpha: 0.5];
CGContextSetStrokeColorWithColor(context, black.CGColor); 
CGContextSetLineWidth(context, 10);
CGContextSetLineCap(context, kCGLineCapRound);
CGContextAddPath(context, path);
CGContextStrokePath(context);
CFRelease(path);
 }
 
 @end
 
 Any hints?
 
 Thanks,
 David
 
 ___
 
 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/archive%40mail-archive.com

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


Re: Problem with UITableView

2010-07-31 Thread Luke Hiesterman
Are you returning the same cell 4 times? That's not right. You're going to need 
4 separate cell instances even if they are of the same class and layout. It 
sounds like you might be taking 1 cell instance out of a nib and returning that 
each time. 

Luke

Sent from my iPhone.

On Jul 31, 2010, at 9:17 PM, Laurent Daudelin laur...@nemesys-soft.com wrote:

 I've been banging my head on this for over a day now and I just can't find 
 what's wrong with my tableview and the tableview cells.
 
 Basically, as you can see here:
 
 http://nemesys.dyndns.biz/Images/iPhoneScreenshot.png
 
 I have a table view made of 2 sections. Section 1 has only one tableview cell 
 and, right now, it's barebone. Section 2 is supposed to have 4 cells. When I 
 use a cell from my xib file in Interface Builder and the tableview appears, 
 even though my method tableView:cellForRowAtIndexPath: is called 4 times, 
 only the last cell is showing. If I however create the cells programmatically 
 using:
 
 [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle 
 reuseIdentifier:CellIdentifier] autorelease]
 
 then they show up properly. Of course, the cell is created only once because 
 on subsequent calls, I'm using the tableview 
 dequeueReusableCellWithIdentifier:.
 
 I just don't get it. I use the same methods to set the textLabel and the 
 detailTextLabel in both cases. I just tried a few times of dragging a default 
 UITableView cell from the IB's Data Views tab, I don't modify it in any way 
 in IB except to give it a cell identifier and connect it to my tableview 
 controller so it can provide it to its tableview, it just won't work and I 
 get the tableview showing as in the picture above. I want to use a tableview 
 cell in IB because I need to add additional labels to it and don't feel like 
 doing it programmatically.
 
 So, anybody can see what I am missing? I've done the same thing in other 
 iPhone projects I just can't see why I can't do it now and I'm at the end of 
 my rope here.
 
 Thanks in advance for any comment, info or help!
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelinhttp://www.nemesys-soft.com/
 Logiciels Nemesys Software  
 laur...@nemesys-soft.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
___

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: Question about fading a UISlider

2010-06-15 Thread Luke Hiesterman
You can try setting shouldRasterize = YES on the layer. 

Luke

Sent from my iPhone.

On Jun 15, 2010, at 6:08 AM, Eric E. Dolecki edole...@gmail.com wrote:

 I am animating the alpha of a UISlider, and you can see that the UI is
 actual composed of two rounded rectangles with a round button above the
 union point. Is there a layer mode (like blendMode.LAYER in Flash's AS3)? So
 that you can't see the guts of the control as it's faded.
 
 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/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/archive%40mail-archive.com

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


Re: Using table view cells from nibs

2010-05-29 Thread Luke Hiesterman
I'm not sure why you're trying to separate the ideas of row and cell height. I 
don't think there's any reason why you should ever attempt to have a cell whose 
height is different from the height returned in heightForRowAtIndexPath. In 
fact, you shouldn't even be setting cell frames yourself. The table view does 
this for you based on the width of the table and the height the delegate 
returns. 

To speak to the original poster, heightForRowAtIndexPath is THE way to set the 
height of your cells. If you expect a certain height when you design your cell 
in IB then you should make sure to return that height from your delegate. 

Luke

Sent from my iPad

On May 29, 2010, at 1:32 AM, Quincey Morris quinceymor...@earthlink.net wrote:

 On May 28, 2010, at 23:39, Tino Rachui wrote:
 
 I've created a table view cell in interface builder with a custom height. 
 However when I load and use that kind of cell at runtime it disregards my 
 custom height. I have to use 'heightForRowAtIndexPath' to set the desired 
 cell height. Is there anything I'm missing?
 
 Well, the row height and the cell height are different things. The table 
 view's built-in behavior places the cell at the top (AFAIK) of the row height.
 
 A custom cell can place itself at the vertical center (for example) of the 
 row height, but that doesn't help you.  You *need* to use 
 'heightForRowAtIndexPath' to make the rows tall enough for your custom cells. 
 (Or, if possible, just set a larger row height in the table view in IB, if a 
 single height works for all rows.)
 
 
 ___
 
 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/archive%40mail-archive.com

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


Re: Supporting different orientations with UITabBarView?

2010-04-17 Thread Luke Hiesterman
You should post some sample code of the tabBarController not autorotating. The 
behavior of the tabBarcontroller should definitely be to rotate if all of it's 
child viewViewControllers support rotation to the given orientation. 

Luke 

Sent from my iPad

On Apr 17, 2010, at 3:56 PM, Laurent Daudelin laurent.daude...@gmail.com 
wrote:

 Well, I thought about this and checked my xib. I then realized that the 
 default TabBarController was a UITabBarController. The documentation says 
 that, by default, controllers will only return YES from 
 shouldAutorotateToInterfaceOrientation when the orientation is portrait. So, 
 I did subclass the TabBarController and in my subclass, I do return YES from 
 shouldAutorotateToInterfaceOrientation. I know that my other 2 
 UITableViewController instances return YES to the same method so I'm not sure 
 where to look for the broken link.
 
 When I look at my xib file, I see that the TabBarController has a TabBar but 
 I don't think I need to subclass this one as it is a view, not a controller. 
 The 2 view controlled by the TabBarController are my subclasses of 
 UITableViewController and they both implement 
 shouldAutorotateToInterfaceOrientation and return YES, so I'm puzzled why it 
 doesn't work.
 
 I'm still missing something it seems...
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://nemesys.dyndns.org
 Logiciels Nemesys Software
 laurent.daude...@gmail.com
 Photo Gallery Store: 
 http://laurentdaudelin.shutterbugstorefront.com/g/galleries
 
 On Apr 17, 2010, at 11:58, Luke the Hiesterman wrote:
 
 Each respective's tab's viewController must return YES from 
 shouldAutorotateToInterfaceOrientation for the tabBarController to 
 autorotate, not just the currently visible one.
 
 Luke
 
 On Apr 17, 2010, at 11:48 AM, Laurent Daudelin wrote:
 
 Not sure what I'm missing here but obviously, I'm missing something. If I 
 create a project based on a navigation controller and override 
 'shouldAutorotateToInterfaceOrientation:' to return YES all the time, when 
 the device is rotated, the tableview correctly rotates and resizes itself.
 
 However, if I have tab view based app, nothing happens. The tab view has 2 
 views which are both based on navigation views.
 
 What am I missing?
 
 -Laurent.
 
___

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: question about orientation

2010-01-21 Thread Luke Hiesterman
UIViewcontroller with autorotation is the best way to do this. Then  
you don't need to deal with UIDevice orientations.


Luke

Sent from my iPhone.

On Jan 21, 2010, at 8:30 AM, Eric E. Dolecki edole...@gmail.com  
wrote:


I am sending a view orientation data which works great, if the phone  
is held

up...

UIDeviceOrientation orientation = [[UIDevice currentDevice]  
orientation];


if( orientation == UIDeviceOrientationLandscapeLeft || orientation ==
UIDeviceOrientationLandscapeRight ){

[myView iAmLandscape:YES];

} else if(orientation == UIDeviceOrientationPortrait) {

[myView iAmLandscape:NO];

}


However if I have the phone angled back almost flat in my hand, it  
isn't
caught ... UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown  
seem to
screw this up. When some people use their phone, they hold it flat  
in their
hand which seems to produce an orientation of face up, but doesn't  
provide

portrait or landscape information.


What's the best way to tackle this?
___

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/archive%40mail-archive.com

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


Re: iPhone: question about orientation

2010-01-21 Thread Luke Hiesterman
If you use autorotation you guarantee that your own app's rotation  
follows the same patterns of the system apps and thereby what the user  
is used to and expects. While a flat phone is by nature ambiguous from  
an interface orientation perspective, following the system's lead is  
the best path here.


Luke

Sent from my iPhone.

On Jan 21, 2010, at 9:36 AM, Eric E. Dolecki edole...@gmail.com  
wrote:


Wouldn't autorotation fall into the same category of problem? Should  
I also look into device rotation in tandem with orientation just in  
case orientation fails?


On Thu, Jan 21, 2010 at 12:17 PM, Luke Hiesterman  
luket...@apple.com wrote:
UIViewcontroller with autorotation is the best way to do this. Then  
you don't need to deal with UIDevice orientations.


Luke

Sent from my iPhone.


On Jan 21, 2010, at 8:30 AM, Eric E. Dolecki edole...@gmail.com  
wrote:


I am sending a view orientation data which works great, if the phone  
is held

up...

UIDeviceOrientation orientation = [[UIDevice currentDevice]  
orientation];


if( orientation == UIDeviceOrientationLandscapeLeft || orientation ==
UIDeviceOrientationLandscapeRight ){

[myView iAmLandscape:YES];

} else if(orientation == UIDeviceOrientationPortrait) {

[myView iAmLandscape:NO];

}


However if I have the phone angled back almost flat in my hand, it  
isn't
caught ... UIDeviceOrientationFaceUp and UIDeviceOrientationFaceDown  
seem to
screw this up. When some people use their phone, they hold it flat  
in their
hand which seems to produce an orientation of face up, but doesn't  
provide

portrait or landscape information.


What's the best way to tackle this?
___

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/archive%40mail-archive.com

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


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

2009-12-26 Thread Luke Hiesterman
Depends on what you want for your app. If you want the user to see the  
table data change then keep it the way it is. If you'd rather the  
change occur out of view use viewWillAppear:


Luke

Sent from my iPhone.

On Dec 26, 2009, at 8:31 PM, Brian Bruinewoud br...@darknova.com  
wrote:



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/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/archive%40mail-archive.com

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


Re: UITableView / iPhone Calendar List View Question

2009-12-17 Thread Luke Hiesterman
It sounds like you have a design problem if you want potentially large  
numbers of sections but it isn't easy to calculate the size of said  
sections. What are you really trying to do?


Luke

Sent from my iPhone.

On Dec 17, 2009, at 8:01 PM, Karolis Ramanauskas karol...@gmail.com  
wrote:


Luke helped me with this a little bit, but, after experimenting, it  
seams

there is more to it.

I guess there is still something I do not understand about this.  
Yes, I can
set a huge number of rows. But I want them to be grouped into  
sections.
However, UITableView wants to know exactly how many rows are in each  
section

on load time, even for invisible sections. So, if I have a rule that
describes recurring events in my model, that means I would have to  
expand
these and calculate, number of rows per section on load. If I have,  
let's
say, 10,000 sections (to imitate the never-ending list) this may be  
a costly
calculation. I assume there is no way around this, but limiting the  
number

of sections to a lot lower numbers...

Peace.
___

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/archive%40mail-archive.com

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


Re: UITextField Cursor Color

2009-11-22 Thread Luke Hiesterman
I don't think this is possible publicly, and non-public methods  
shouldn't be discussed here.


Luke

Sent from my iPhone.

On Nov 21, 2009, at 10:25 PM, Chunk 1978 chunk1...@gmail.com wrote:


textfields in the iPhone SDK default to a blue color.  i would like to
change this color to white.  i've checked the docs, and while the  
following

method would work for development with Mac OS X, it is (currently) not
present for the iPhone:

[myTextField setInsertionPointColor:[UIColor whiteColor]];

//i assume the iPhone equivalent would be the same only to replace  
NSColor

with UIColor.

does anyone know of a workaround?  perhaps an undocumented method?
___

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/archive%40mail-archive.com

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


Re: How to change UITableView cell style dynamically

2009-11-21 Thread Luke Hiesterman
If you have 2 different styles of cells then you should have 2  
different reuse identifiers. Then when you dequeue, you ask for an  
available cell of the apropeiate type.


Luke

Sent from my iPhone.

On Nov 21, 2009, at 1:55 AM, Tharindu Madushanka  
tharindu...@gmail.com wrote:



Hi

Removing reuse identifier solved the problem so now I am creating a  
cell

like below. It worked.

UITableViewCellStyle style;
if(profile.name.length  0) {
   style = UITableViewCellStyleSubview;
} else {
   style = UITableViewCellStyleDefault;
}

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:style
reuseIdentifier:nil]autorelease];

No reuse identifiers or dequeue method in table view is not used while
creating cells

Since its only once cell, doing this is ok ? is it ?

-Tharindu
___

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/archive%40mail-archive.com

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


Re: How to change UITableView cell style dynamically

2009-11-21 Thread Luke Hiesterman
I'm sure you could get away without doing that in this case because  
your table is so simple. The solution I gave you, though, will scale  
in case you ever need to do it on a bigger table.


Luke

Sent from my iPhone.

On Nov 21, 2009, at 6:38 AM, Tharindu Madushanka  
tharindu...@gmail.com wrote:


mm ok I will add two types of cells. But since its only a single  
cell table, I thought there would not be any performance issue or  
something doing that.


On Sat, Nov 21, 2009 at 8:01 PM, Luke Hiesterman  
luket...@apple.com wrote:
If you have 2 different styles of cells then you should have 2  
different reuse identifiers. Then when you dequeue, you ask for an  
available cell of the apropeiate type.


Luke

Sent from my iPhone.


On Nov 21, 2009, at 1:55 AM, Tharindu Madushanka tharindu...@gmail.com 
 wrote:


Hi

Removing reuse identifier solved the problem so now I am creating a  
cell

like below. It worked.

UITableViewCellStyle style;
if(profile.name.length  0) {
  style = UITableViewCellStyleSubview;
} else {
  style = UITableViewCellStyleDefault;
}

UITableViewCell *cell = [[[UITableViewCell alloc] initWithStyle:style
reuseIdentifier:nil]autorelease];

No reuse identifiers or dequeue method in table view is not used while
creating cells

Since its only once cell, doing this is ok ? is it ?

-Tharindu
___

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/archive%40mail-archive.com

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


Re: [iPhone] iPhone Screen with Add Photo and UITableView

2009-11-15 Thread Luke Hiesterman

What you see in Contacts is probably all in a tableHeaderView.

Luke

Sent from my iPhone.

On Nov 15, 2009, at 2:40 AM, Tharindu Madushanka  
tharindu...@gmail.com wrote:



Hi

I am trying to implement a screen in that it should have a table  
view, with
add photo button and to right a table view cell. Could I do this  
with a
single table view ? Can anyone point some way to do it. Like in  
contacts app


Thank you,

Tharindu
___

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/archive%40mail-archive.com

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


Re: [iPhone] Custom UIView like in iPhone Messages App

2009-11-08 Thread Luke Hiesterman
Sounds like your main problem is not using a background that looks  
good with scaling. I suggest a new background.


Luke

Sent from my iPhone.

On Nov 7, 2009, at 11:53 PM, Tharindu Madushanka  
tharindu...@gmail.com wrote:



Hi

I have been currently doing something like this.

In my chat view I have a scroll view and my text field is always with
keyboard open. I keep two variables to scale the scroll view content  
size as
the chat messages height get increased over time. So I set the  
content size

bigger if the messages are getting bigger.

And then I have been trying to implement a custom UIView that has a  
label
and image view in it. by getting the font size I can scale the label  
to
multiple lines. And when its multiple lines the image is little bit  
scaled

so it does not look that nice.

Have you used multiple images to do this ? I mean say for a small  
message
different background image and for a very long message another. Or  
what

could be the best size of a background balloon image to get ?

And I could have done something like what you proposed for this :(

Tharindu Madushanka
tharindufit.wordpress.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

___

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] Custom UIView like in iPhone Messages App

2009-11-08 Thread Luke Hiesterman
The idea is that the cap width represents the part of your image that  
won't be stretched when the image is scaled. For example, take a  
circle and set the leftCapWidth to half the circles width. Then  
stretch horizontally and you end up with something that looks like a  
typical UIslider track image.


Luke

Sent from my iPhone.

On Nov 8, 2009, at 4:27 PM, Tharindu Madushanka  
tharindu...@gmail.com wrote:



Hi

I have been trying to figure out whether UIImage method
stretchableImageWithLeftCapWidth:topCapHeight:http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIImage_Class/Reference/Reference.html#//apple_ref/occ/instm/UIImage/stretchableImageWithLeftCapWidth:topCapHeight: 
could

be used in my problem. But the documentation for this seems to be
little confusing for me could anyone just tell what is this  
leftCapWidth and

topCapHeight in simple terms.

Thanks

Tharindu Madushanka

On Mon, Nov 9, 2009 at 12:36 AM, Luke Hiesterman  
luket...@apple.com wrote:

___

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/archive%40mail-archive.com

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


Re: [iPhone] Custom UIView like in iPhone Messages App

2009-11-07 Thread Luke Hiesterman
You want to have a view that scales to multiple lines, and you want  
that view to have a background. You further I desire said background  
to not scale. Am I missing something? That doesn't make sense.


Luke

Sent from my iPhone.

On Nov 7, 2009, at 5:42 PM, Tharindu Madushanka  
tharindu...@gmail.com wrote:



Hi,

I am trying to implement a custom ui view with a background image to  
append
chat messages into a scroll view like in iPhone default Messages SMS  
App.

But I have few things to clarify.

If its multiple lines how can I remove the image scaling so that it  
would

not look like that background image is scaled ?

Could anyone suggest some solution for this.

Thank you

Tharindu Madushanka
tharindufit.wordpress.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

___

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 NavController within TabBarController (nested table views)

2009-10-04 Thread Luke Hiesterman
Yes, you need a nav controller to be the view controller for one of  
your tabs. This case is explicitly covered in the iPhone programming  
guide at developer.apple.com. Check it out.


Luke

Sent from my iPhone.

On Oct 4, 2009, at 3:27 PM, Trygve Inda cocoa...@xericdesign.com  
wrote:


My root view is a TabBarController with three tabs. Each one gets  
its view

from a different nib and all is well... The tab controller handles the
load/unload as the user clicks the tabs.

One of these tabs has a tableview in it's view. I would like to add  
a second
table that is accessed by clicking one cell in the main table (said  
cell

would have a disclosure triangle).

How do I handle switching the view as the view where the main table  
resides

is owned and controlled by the master tabbar controller?

So I guess I need a nav controller within the tabbar controller???

How do I set this up?

I have 4 nibs now:  Main, tab1, tab2, tab3. Tab one contains the  
logic for

the table e.g.:

- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath


So now I need to add a table2 to be accessed from a cell in table1.

Thanks,

Trygve


___

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/archive%40mail-archive.com

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


Re: [iPhone] seeking advise on complex view design

2009-08-11 Thread Luke Hiesterman
Sounds like you know the percentages you want. Just get the  
superview's bounds and calculate your frames using percentages of  
those bounds. Update when orientation changes. Or have subviews auto  
resize.


Luke

Sent from my iPhone.

On Aug 11, 2009, at 7:34 AM, Sean Kline skline1...@gmail.com wrote:

Are you having difficulty laying this out in Interface Builder?  It  
seems

rather straight forward from what you describe.
Regards,
Sean

On Tue, Aug 11, 2009 at 10:14 AM, Ronnie B ronny@gmail.com  
wrote:



Hi list.

I need to create a rather complex view containing the following  
from top to

bottom:

A subview about 20p in height;
Two rows of buttons three in each row (both taking a third of a  
space)

A table view taking about a third of a space
An add banner

I am wondering how this is done.  I need to take into account the  
device

orientation.

Thanks,
Ron
___

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/skline1967%40gmail.com

This email sent to skline1...@gmail.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

___

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

2009-07-31 Thread Luke Hiesterman
I'd make sure your tester is using at least os 3.0. I seem to recall  
slow typing issues in 2.x


Luke

Sent from my iPhone.

On Jul 31, 2009, at 9:20 PM, Development developm...@fornextsoft.com  
wrote:


I'm working on an app and it is fairly large. well... maybe not it's  
about 1.1 megs. I save as much memory as I can but I think its not  
enough. When typing in text fields and text views I get this strange  
lag in the keys. Do any of you happen to know what might cause this?  
I've turned off auto correction thinking that might be part of the  
problem but it does not seem to help too much. What can I be doing  
wrong that coul cause this kind of lag? On one of my testers phones  
he says he cant use the app it slows down so much but on my ipod I  
cannot reproduce.




April.
___

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/archive%40mail-archive.com

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


Re: [iPhone] get iPhone's IP address...

2009-07-20 Thread Luke Hiesterman
Please note that NSHost is NOT publicly supported API on iPhone.  
Attempts to use it may result in unexpected behavior and broken  
applications in future iPhone revisions. Also, using private classes  
is a breach of the iPhone developer terms and conditions. Finally,  
using a private class such as NSHost should not be discussed on this  
list.


Luke

Sent from my iPhone.

On Jul 19, 2009, at 10:50 PM, James Lin jamesclin...@gmail.com wrote:


Hi all,

I found this code snipet that's supposed to return the iPhone's IP  
address.


I am wondering if anyone can confirm the method for me.
As i am told that this method works in an actual iPhone and not on  
the simulator.

But i won't have an iPhone until Aug 9th

All i am getting in the simulator is something like : fe80::21e: 
52ff:fec6:b7401.618407e-303n1


I am wondering if anyone can confirm the method works (ie, returns  
an actual ip address) on an actual iPhone for me


The code:

- (NSString*) getNetAddr {
   char iphone_ip[255];
   strcpy(iphone_ip,127.0.0.1); // if everything fails
   NSHost *myhost =[NSHost currentHost];
   //NSHost *myhost = [[NSHost alloc] init];
   if (myhost)
   {
   NSLog(@myhost exits);
   NSString *ad = [myhost address];
   if (ad)
   strcpy(iphone_ip, [ad cStringUsingEncoding:  
NSISOLatin1StringEncoding]);

   }

   return [NSString stringWithFormat:@%s, iphone_ip];
}

Thank you in advance...

James

___

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/archive%40mail-archive.com

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


Re: [iPhone] get iPhone's IP address...

2009-07-20 Thread Luke Hiesterman
I should also have mentioned that you should be able to get the  
functionality you need via CFHost.


Luke

Sent from my iPhone.

On Jul 20, 2009, at 6:33 AM, Luke Hiesterman luket...@apple.com wrote:

Please note that NSHost is NOT publicly supported API on iPhone.  
Attempts to use it may result in unexpected behavior and broken  
applications in future iPhone revisions. Also, using private classes  
is a breach of the iPhone developer terms and conditions. Finally,  
using a private class such as NSHost should not be discussed on this  
list.


Luke

Sent from my iPhone.

On Jul 19, 2009, at 10:50 PM, James Lin jamesclin...@gmail.com  
wrote:



Hi all,

I found this code snipet that's supposed to return the iPhone's IP  
address.


I am wondering if anyone can confirm the method for me.
As i am told that this method works in an actual iPhone and not on  
the simulator.

But i won't have an iPhone until Aug 9th

All i am getting in the simulator is something like : fe80::21e: 
52ff:fec6:b7401.618407e-303n1


I am wondering if anyone can confirm the method works (ie, returns  
an actual ip address) on an actual iPhone for me


The code:

- (NSString*) getNetAddr {
 char iphone_ip[255];
 strcpy(iphone_ip,127.0.0.1); // if everything fails
 NSHost *myhost =[NSHost currentHost];
 //NSHost *myhost = [[NSHost alloc] init];
 if (myhost)
 {
 NSLog(@myhost exits);
 NSString *ad = [myhost address];
 if (ad)
 strcpy(iphone_ip, [ad cStringUsingEncoding:  
NSISOLatin1StringEncoding]);

 }

 return [NSString stringWithFormat:@%s, iphone_ip];
}

Thank you in advance...

James

___

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


___

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 Grouped Table View for Settings

2009-07-17 Thread Luke Hiesterman
Create a view based xib. In the generic view provided add all your  
custom views including a UITableView. Don't drag a  
UITableViewController - just the UITableView itself. Then be sure to  
set the table views data source and delegate outlets to one or two of  
your objects that will handle those tasks.


Luke

Sent from my iPhone.

On Jul 17, 2009, at 6:39 AM, Trygve Inda cocoa...@xericdesign.com  
wrote:


Look at the table view programming guide for how to build custom  
table

cells. Just think of each cell as a custom view. They can even be
built in IB easily enough. Drag UITableViewCell objects into your nib
and lay them out however you like.

Luke

Sent from my iPhone.


So I want a TableView but also a few other views in the same screen/ 
window.


How can I do this in IB. I see examples where the TableView is the  
only view

on the screen, and it wants to size itself to max.

Basically my thought was to just drag a TableView onto the view  
along with

other objects, but the docs seem to strongly encourage using a
TableViewController.

In the MacOS side of things, I would drag a controller to the nib and
connect it to my table, but the iPhone TableViewController seems to  
include
the view already so I am not sure how to make it consume only a  
portion of

the main view.

T.



___

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 Grouped Table View for Settings

2009-07-16 Thread Luke Hiesterman
Look at the table view programming guide for how to build custom table  
cells. Just think of each cell as a custom view. They can even be  
built in IB easily enough. Drag UITableViewCell objects into your nib  
and lay them out however you like.


Luke

Sent from my iPhone.

On Jul 16, 2009, at 9:34 PM, Trygve Inda cocoa...@xericdesign.com  
wrote:


I don't want to use the Settings app as I need a clean way for the  
user to
get to the settings from within my app and then return to my app. So  
I need
to build a grouped table view, with each cell containing a single  
control

(and a label) like the settings app does.

For example, I need a table with two rows, each row needs a label,  
slider

and text (numeric value of slider).

How can I do this? There seems to be no way to build it in IB  
directly. I
need a way to make the two sliders IBOutlets so that I can  
manipulate them.
As my cells will be static (just the label, slider, text), it seems  
simple,

but I have found no examples of this.

I also need another group - same as above but with switches.

Thanks for any leads to examples or the best way to achieve this.

Trygve


___

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/archive%40mail-archive.com

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


Re: [iPhone] Addressbook group problem

2009-07-13 Thread Luke Hiesterman

Ditto that.

Luke

Sent from my iPhone.

On Jul 12, 2009, at 10:15 PM, Roland King r...@rols.org wrote:


ABAddressBookCopyArrayOfAllGroups()?

James Lin wrote:

Hi,
Sorry  I didn't frame my question more clearly...
The part I am having trouble with is finding out if a group name   
already exists in the addressbook,
is there a way to do this? the ABGroup documentation has no  
function  that allows this...

any suggestions?
Thank you in advance...
James
On 2009/7/11, at 下午 9:36, Luke Hiesterman wrote:
The group doesn't have a name when you create it. Try setting the   
name after creation rather than getting it.


Luke

Sent from my iPhone.

On Jul 11, 2009, at 12:50 AM, James Lin jamesclin...@gmail.com   
wrote:



Hi all,

Anyone familiar with the Addressbook framework?

I can't seem to be able to add a group into the addressbook  
only  ONCE.


if i use ABRecordRef group = ABGroupCreate(); to get a handle on   
group,


calling NSString *groupName = (NSString  *) 
ABRecordCopyCompositeName(group);


returns a NULL.

so I can't seem to be able to check if a group name already  
exists  and don't have to re-create the group again.


Can you please help me and point me in the right direction?
How do I create group only once?

Thank you and best regards...

James
___

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/rols%40rols.org
This email sent to r...@rols.org

___

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] Addressbook group problem

2009-07-11 Thread Luke Hiesterman
The group doesn't have a name when you create it. Try setting the name  
after creation rather than getting it.


Luke

Sent from my iPhone.

On Jul 11, 2009, at 12:50 AM, James Lin jamesclin...@gmail.com wrote:


Hi all,

Anyone familiar with the Addressbook framework?

I can't seem to be able to add a group into the addressbook only  
ONCE.


if i use ABRecordRef group = ABGroupCreate(); to get a handle on  
group,


calling NSString *groupName = (NSString *)ABRecordCopyCompositeName 
(group);


returns a NULL.

so I can't seem to be able to check if a group name already exists  
and don't have to re-create the group again.


Can you please help me and point me in the right direction?
How do I create group only once?

Thank you and best regards...

James
___

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/archive%40mail-archive.com

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


Re: UITextView and UiImageView

2009-07-11 Thread Luke Hiesterman
Try using a UIScrollView and adding various UITextViews and  
UIImageViews as subviews to the content view of the scrollview.


It's a little tedious and depending on what you're doing a web view  
might be better.


Hope that helps.

Luke

Sent from my iPhone.

On Jul 11, 2009, at 3:24 AM, M.S. Hrishikesh hris...@gmail.com  
wrote:


This is a question related to UIKit. Sorry if I am posting to the  
wrong list. I did not find a more appropriate list at

http://lists.apple.com/mailman/listinfo


The question:

I want to display both text and images in my view. I want the  
content to be scrollable. When the user scrolls the view images as  
well as text to scroll.


How do I achieve this? I cannot embed a UIImageView inside a  
UITextView. I could use a UIWebView but then I would have to change  
all of my content into HTML format rather than hold it as plain  
text. Is there an alternative way to to what I want?


Thanks
Hrishi
___

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/archive%40mail-archive.com

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


Re: iPhone camera control like RedLaser

2009-07-08 Thread Luke Hiesterman

There is no API for that at this time.

Luke

Sent from my iPhone.

On Jul 8, 2009, at 12:00 AM, Mike Manzano  
m...@instantvoodoomagic.com wrote:


The RedLaser app overlays a display on the 3GS' video capture  
screen, and seems to be able to react to the video in real time. Are  
they using public APIs to do this? If so, I can't find them.


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/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/archive%40mail-archive.com

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


Re: Send files from iphone

2009-07-03 Thread Luke Hiesterman

Check out documentation on NSURLRequest and NSURLConnection.

Luke

Sent from my iPhone.

On Jul 3, 2009, at 7:20 PM, Development developm...@fornextsoft.com  
wrote:


I need to be able to upload the data from a UIImage to a server via  
http POST however I simply cannot find a good example of how to  
arrange the headers or how to make this post.
The only data I need to send to the server is the file's name, the  
user's name and the data itself and I simply cannot seem to get it  
to work. Can any of you offer a helping hand?

___

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/archive%40mail-archive.com

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


Re: Help, I need a jedi memory master with time and patience to help me here.

2009-03-12 Thread Luke Hiesterman
My guess is it's not really a memory issue. I'll glance at it for you,  
though.


Luke

Sent from my iPhone.

On Mar 12, 2009, at 8:11 AM, James Cicenia ja...@jimijon.com wrote:


Hello -

I must be doing something conceptually wrong as this class will  
alway kill my app in the device without any console info. I am sure  
it is memory or retain related.
In instruments my memory never goes above 5MB and then comes down a  
bit. In the device... it just quits after a few calls.


If anyone has time, charity and patience and can help me spot what I  
am doing wrong, I would appreciate it. Just send me a response to me  
and I will send you the code.


I have worked days on this. I have optimized my images. But  
something is wrong. One thing I did notice the retain count starts  
at 2 and ends at 2. I don't know if this is a hint or not.


thank you kindly,
James Cicenia

___

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/archive%40mail-archive.com

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


Re: Which language to get started with cocoa development?

2009-01-05 Thread Luke Hiesterman
If you truly want do cocoa you should learn objective-c. That is the  
flagship language. Shouldn't be too difficult for a professional  
programmer to pick up.


Luke

Sent from my iPhone.

On Dec 31, 2008, at 12:22 AM, Achim Domma do...@procoders.net wrote:


Hi,

I develop software for a living and want to get started with cocoa  
development just for fun. I'm good at python, C, C++ and C# and have  
some Ruby knowledge. Now I'm asking myself, which language I should  
use to get started with cocoa development:


- ObjC looks interesing, but would be a new language to learn. I  
like to learn new languages, but I also prefer to do one step after  
another. So learning Cocoa and Obj-C toghether could be frustrating.
- I like dynamic scripting languages like python and ruby, but I  
would like to ship my apps to other users. And they should not care  
about the language I have used. Can pyObjC or RubyCoca be bundled  
with my app, so that the enduser will not recognize that python/ruby  
is shipped with my app?
- As far as I understand, GUIs are usually build with the interface  
builder of XCode. That tools is tuned to be used with ObjC. How good  
is the integration with scripting languages?
- How up to date are bindings to non ObjC languages usually? If I  
will like cocoa development, I want to have a look at core data and  
core animations. Are these also available for ruby and python?
- What about Mono/Cocoa#? Looks like Mono is not an good option, if  
I want to distribute my app as small download via the web. Or am I  
wrong?


I would be very happy to hear some opinions of experienced cocoa  
developers about these topics. Any feedback would be very appreciated.


cheers,
Achim
___

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/archive%40mail-archive.com

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


Re: Newbie Q: Why is UIWindow in the AppDelegate not an ivar?

2008-12-13 Thread Luke Hiesterman
Generally speaking you will do well for yourself to follow Apple's  
example over Erica's. I haven't actually read her book but I've had  
several examples come to my attention of where she doesn't do things  
in the best way.


Erica is a talented hacker but please get in the habit of following  
the canonical examples. These have been thoroughly vetted and approved  
my many experts.


Luke

Sent from my iPhone.

On Dec 13, 2008, at 7:22 PM, Debajit Adhikary deba...@debajit.com  
wrote:


I meant to ask what the tradeoffs are between declaring the UIWindow  
object

as an instance variable in the AppDelegate vs. as a local object in
-applicationDidFinishLaunching:

The specific example I'd mentioned was from Erica Sadun's book, and  
looking
at Apple's sample code, and the code that XCode generates, it seems  
that the

UIWindow object is typically declared as an instance variable in the
AppDelegate and seems the way to go (as opposed to Erica Sadun's  
example of

using a local UIWindow object).


On Sat, Dec 13, 2008 at 6:34 PM, Debajit Adhikary  
deba...@debajit.comwrote:



When you create an iPhone app, in the AppDelegate, why is the
UIWindow created locally within -applicationDidFinishLaunching and  
not

declared
as an ivar? The functionality does not seem to change either way. I'd
like to know how one approach is better than the other.

What I presume is that the window object really doesn't need to be  
accessed

from outside later. But doesn't declaring it as an ivar make it more
accessible from the outside allowing greater application  
extensibility?


@implementation AppDelegate

- (void) applicationDidFinishLaunching:(UIApplication*) application
{
  UIWindow* window = ... ;
  [window addSubView: ...];
  [window makeKeyAndVisible];
}

...
@end



___

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/archive%40mail-archive.com

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


Re: iPhone Orientation

2008-12-08 Thread Luke Hiesterman
The UIKit changes orientation for you if you respond YES to  
shouldAutoRotateToOrientation which is part of UIViewController.


Luke

Sent from my iPhone.

On Dec 6, 2008, at 9:19 AM, Bruce Martin [EMAIL PROTECTED] wrote:

I'm not sure this is the right list but a search in the Archives  
returned no results for this question so that makes this question a  
simple one, or maybe no one else has had an issue with it.
I am trying to get notifications that the orientation of the iPhone  
has changed, if it changed then I want to change the view to a new  
view which will contain different information than the original  
upright view.


I tried looking for some examples or tutorials but can't find  
anything so the more basic your answer the better :)

Thanks
Bruce Martin
The Martin Solution
[EMAIL PROTECTED]
http://www.martinsolution.com
http://externals.martinsolution.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 [EMAIL PROTECTED]

___

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 [EMAIL PROTECTED]


Re: What are the limitations of Dot Syntax?

2008-12-05 Thread Luke Hiesterman
The compiler must be able to resolve the class for dot syntax to work.  
Try casting.


Luke

Sent from my iPhone.

On Dec 5, 2008, at 4:32 PM, Jerry Krinock [EMAIL PROTECTED] wrote:

I've been having some unexpected results trying to compile code  
using Objective-C's Dot Syntax.  I realize that this may be due to  
an important question that I didn't find the answer to when I read  
about Objective-C 2.0 Properties is:  Can you use the dot syntax for  
regular messages that take 0 arguments?


To test, I did this:

   NSURL* urlIn = [NSURL fileURLWithPath:@/Hello/World.txt] ;
   NSSet* set = [NSSet setWithObjects:urlIn, nil] ;

And now I want to access those values:

   NSString* path ;
   NSURL* url ;

And I find that this works:

   url = set.anyObject ;
   path = url.path ;

So, it looks like the dot syntax is OK with regular messages that  
take 0 arguments.


But then, either of these do not compile:

   path = set.anyObject.path ;
   path = (set.anyObject).path ;

In either case,

   error: request for member 'path' in something not a structure or  
union


Then why did it work fine when in url.path by itself?

Is this limitation in the Objective-C language, or is it in the  
current gcc/Xcode 3.1 version which I am using?


Regarding gcc, certainly that error message should be updated to say  
...in something not a structure or union, nor a property.


And Xcode doesn't line up my colons when I paste in a multi-line  
statement with mix dot syntax and square-brackets mixed.  (Please  
view in monospaced font):


   NSMutableDictionary* dic = [NSMutableDictionary dictionary] ;
   NSSet* set = [NSSet setWithObject:dic] ;
   [set.anyObject setObject:@parrot
forKey:@bird] ;
   NSLog([set.anyObject objectForKey:@bird]) ;

The above compiles and runs as expected, logging parrot.  But the  
third and fourth lines are ugly.  Xcode should line up the colons  
like this:


   [set.anyObject setObject:@parrot
 forKey:@bird] ;

And, of course, this is definitely an issue with Xcode because it  
does the same thing even if, instead of set.anyObject, I use foo.bar  
where 'bar' is declared with @property.


Does anyone know exactly what the rules are here?

Jerry Krinock

___

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 [EMAIL PROTECTED]

___

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 [EMAIL PROTECTED]


Re: Beginner memory management question

2008-12-03 Thread Luke Hiesterman
What you should do is declare newName as a property and then do  
self.newName = [stockName stringValue];


The synthesized property will take care of retaining and releasing for  
you.


Luke

Sent from my iPhone.

On Dec 3, 2008, at 2:13 AM, Jacob Rhoden [EMAIL PROTECTED] wrote:

I am not sure how one would go about working this, Im writing my  
first test os/x applications and I am thinking this is probably  
not right. Am I doing the retain in the correct place? I tried  
reading the documentation on NSTextField but it didnt give me a clue  
about if I needed to retain. (Infact stringValue is not even  
mentioned in the NSTextField documentation).


@interface StockListController : NSObject {
   IBOutlet NSTextField* stockName;
   NSString *newName;
}
-(IBAction) addStockItem:(id)sender;
@end

@implementation StockListController

-(IBAction) addStockItem:(id)sender {
   if(newName == nil) [newName release];
   newName = [stockName stringValue];
   [newName retain];
}

___

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 [EMAIL PROTECTED]

___

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 [EMAIL PROTECTED]


Re: self = [super init];

2008-12-03 Thread Luke Hiesterman

What makes you think that it would?

Sent from my iPhone.

On Dec 3, 2008, at 11:14 AM, EVS [EMAIL PROTECTED] wrote:


self = [super init];

Why does the above  line of code not cause a memory leak or memory  
fault?


___

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 [EMAIL PROTECTED]

___

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 [EMAIL PROTECTED]


  1   2   >