Re: Method name starts with "set"

2016-08-02 Thread Pascal Bourguignon


> Le 2 août 2016 à 07:11, Trygve Inda  a écrit :
> 
> I have a class where I would like to have a method name like:
> 
> -(void)setMaximumOperations:(NSInteger)operations
> {
>  [[self operationQueue] setMaxConcurrentOperationCount:operations];
> 
>   ... Do other stuff ...
> }
> 
> Is this a bad idea? There is no property called "maximumOperations" in my
> class but using a "set" method name in this way may imply there is, although
> the compiler likely doesn't care.
> 
> How is the best way to name something like this?

Actually, there is no difference between a property and a pair of getter/setter 
methods.  Here you have defined a write-only property, and since you have this 
method, you could write: 

   o.maximumOperations=42;

as well as:

   [o setMaximumOperations:42]

The same code is generated in both cases. 

If you added a method -(NSInteger)maximumOperations then you'd have a 
read-write property. 

You can call it a derived property, since it is not implemented directly as a 
slot of your instances. 



-- 
__Pascal Bourguignon__

___

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

Please do not post 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

Sprite Kit app won’t operate in foreground

2016-08-02 Thread Charles Jenkins
A few weeks ago I wrote about a demo app that seemed to expire—it would
work perfectly for a few weeks and then crash whenever opened.

Carl Hoefs advised me how to look for crash logs on the device. I did, and
was surprised to find there is no crash log for my app. It’s not actually
crashing!

If I double-click the home button, I find my app there in the task list.
But when I tap to bring it to the foreground, the splash screen shows for a
half second, then I’m returned to Springboard.

If I flick the app out of the task list to kill it and restart, I get the
same behavior. But I have already learned that if I connect to my laptop
and run the app under the debugger, it will reload and run correctly, then
continue to function normally for a few weeks.

Does anyone have experience with such behavior? Could I be doing something
wrong with SpriteKit to make the app hibernate instead of showing the main
scene?

What could make an app resign foreground status every time it is restored?

-- 

Charles
___

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

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

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

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

Re: Sprite Kit app won’t operate in foreground

2016-08-02 Thread Jeff Szuhay
Can your main window become key? In other words, accept inputs?


> On Aug 2, 2016, at 5:18 AM, Charles Jenkins  wrote:
> 
> A few weeks ago I wrote about a demo app that seemed to expire—it would
> work perfectly for a few weeks and then crash whenever opened.
> 
> Carl Hoefs advised me how to look for crash logs on the device. I did, and
> was surprised to find there is no crash log for my app. It’s not actually
> crashing!
> 
> If I double-click the home button, I find my app there in the task list.
> But when I tap to bring it to the foreground, the splash screen shows for a
> half second, then I’m returned to Springboard.
> 
> If I flick the app out of the task list to kill it and restart, I get the
> same behavior. But I have already learned that if I connect to my laptop
> and run the app under the debugger, it will reload and run correctly, then
> continue to function normally for a few weeks.
> 
> Does anyone have experience with such behavior? Could I be doing something
> wrong with SpriteKit to make the app hibernate instead of showing the main
> scene?
> 
> What could make an app resign foreground status every time it is restored?


___

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

Please do not post 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:Sprite Kit app won’t operate in foreground

2016-08-02 Thread Kirk
 
I also have such an app. 

No SpriteKit in it, so there's one variable eliminated. 
 
It also is magically rejuvenated by running it from Xcode. 

No log messages on the phone. 

Kirk Kerekes 
(iPhone)

> On Aug 2, 2016, at 2:00 PM, cocoa-dev-requ...@lists.apple.com wrote:
> 
> Subject: Sprite Kit app won’t operate in foreground
> Message-ID:
>
> Content-Type: text/plain; charset=UTF-8
> 
> A few weeks ago I wrote about a demo app that seemed to expire—it would
> work perfectly for a few weeks and then crash whenever opened.

___

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

Please do not post 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

Justification of collection cells in sections

2016-08-02 Thread Doug Hill
I'm trying to display a list of items in a UICollectionView. I have multiple 
sections for these items and a fixed cell width but dynamic height. I'm using 
the standard flow layout. The items are layed out in three columns by setting 
the estimated item size and auto-layout constraints. My collection view 
delegate/data source is extremely basic: I implement 
numberOfSectionsInCollectionView, numberOfItemsInSection, and 
cellForItemAtIndexPath with almost nothing except the bare minimum. I return a 
fixed number of sections and a variable number of items in each section based 
on a data model. cellForItemAtIndexPath dequeues one cell type and changes the 
text on two labels in the cell.

Now the funniness: When there is more than one item in a section, the cells 
fill in the space from left to right, flowing across multiple lines as needed. 
However, if there is one item in a section, it lays out that cell in the center 
of the collection view. This looks really weird and breaks up the flow.

Here is an ascii rendering of what this looks like:

-
|   |
|  Section 1   |
|  [cell 0]--[cell 1]---[cell 2]  |
|  [cell 3]   |
|   |
|  Section 2   |
| --- [cell 0]--|
|   |
|  Section 3   |
|  [cell 0]--[cell 1]- |
|   |
| Section 4|
| --- [cell 0]--|
|   |
-

Notice in section 2 and 4, the only cell is layed out in the middle of the 
collection view, while the cells in the other sections flow from left to right.

Any ideas on how to make the single item section flow from left to right rather 
than centered?

Thanks.

Doug Hill
___

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

Please do not post 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: Justification of collection cells in sections

2016-08-02 Thread Raglan T. Tiger

> 
> Any ideas on how to make the single item section flow from left to right 
> rather than centered?


Accessing the Layout Attributes 

 <> <> <> <> <>frame
 

 Property
 <> <> <> <> <>bounds
 

 Property
 <> <> <> <> <>center
 

 Property
The center point of the item.

Declaration
SWIFT
var center: CGPoint 

OBJECTIVE-C
@property(nonatomic) CGPoint  
center
Discussion
The center point is specified in the coordinate system of the collection view. 
Setting the value of this property also updates the origin of the rectangle in 
the frame 

 property. 

Availability
Available in iOS 6.0 and later.


___

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

Please do not post 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: Justification of collection cells in sections

2016-08-02 Thread Doug Hill
Raglan,

Thanks for the response.

I was hoping to allow the Flow Layout to handle this rather than me handling 
the layout. Given how the layout works for multiple items in a section, I would 
presume there is some way to make this work the same for a single item in a 
section. Am I wrong?

Doug Hill


> On Aug 2, 2016, at 4:41 PM, Raglan T. Tiger  wrote:
> 
> 
>> 
>> Any ideas on how to make the single item section flow from left to right 
>> rather than centered?
> 
> Accessing the Layout Attributes 
> 
>  <> <> <> <> <>frame
>  
> 
>  Property
>  <> <> <> <> <>bounds
>  
> 
>  Property
>  <> <> <> <> <>center
>  
> 
>  Property
___

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

Please do not post 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: Justification of collection cells in sections

2016-08-02 Thread Peter Tomaselli
I’ve been in the same situation too (wanting a “left-justified” flow layout) 
and the only way I am aware of to tackle it is to subclass 
UICollectionViewFlowLayout and tweak the frames yourself. Luckily this is not 
nearly as complicated as handling the whole layout yourself!

Peter

On Aug 2, 2016, at 7:51 PM, Doug Hill  wrote:

> I was hoping to allow the Flow Layout to handle this rather than me handling 
> the layout. Given how the layout works for multiple items in a section, I 
> would presume there is some way to make this work the same for a single item 
> in a section. Am I wrong?
> 
> Doug Hill


___

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

Please do not post 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