Date   

Re: resizeWithOldSuperviewSize not getting called on added Subview

Dave
 

I did the resizing in the viewDidEndLiveResize method and it does resize correctly, but the problem is that the image stays at the old size until the User stops re-sizing the window (e.g. mouseUp’s) and then it resizes them, which won’t do!

I’ll keep digging!

On 28 Sep 2018, at 19:15, Dave <dave@...> wrote:

Hi Again,

After digging around a little I find this:

https://lists.apple.com/archives/cocoa-dev///2005/Oct/msg00476.html

It seems that someone else has noticed this way back in 2005! From looking at the article, it mentions:

-(void) viewDidEndLiveResize

While I added to the GameImageView class and it does get called, I’m not sure if I can use it or not, but I’d really, really, really like to know if resizeWithOldSuperviewSize is a known bug or if I’m doing something wrong?

All the Best
Dave

On 28 Sep 2018, at 12:34, Dave <dave@...> wrote:

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding  GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//**  Setup the Image View Frame based on the Cell’s view   *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave


On 27 Sep 2018, at 20:10, Dave <dave@...> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView. 

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave














Re: resizeWithOldSuperviewSize not getting called on added Subview

Dave
 

Hi Again,

After digging around a little I find this:

https://lists.apple.com/archives/cocoa-dev///2005/Oct/msg00476.html

It seems that someone else has noticed this way back in 2005! From looking at the article, it mentions:

-(void) viewDidEndLiveResize

While I added to the GameImageView class and it does get called, I’m not sure if I can use it or not, but I’d really, really, really like to know if resizeWithOldSuperviewSize is a known bug or if I’m doing something wrong?

All the Best
Dave

On 28 Sep 2018, at 12:34, Dave <dave@looktowindward.com> wrote:

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//** Setup the Image View Frame based on the Cell’s view *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave


On 27 Sep 2018, at 20:10, Dave <dave@looktowindward.com> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave








Re: Mail Icon for iOS

Quincey Morris
 

Not necessarily. I don’t have a documentation link, but I’m pretty sure that Apple won’t let you use one of their icons for a function (e.g. “Send Mail”) in your own app. If you’re using the icon to represent the app itself (e.g. to choose an app to use for sending mail from a list of apps), then I think it’s OK, but I seem to recall that you can’t just appropriate Apple iconography.

On Sep 28, 2018, at 06:00 , Steve Mills via Groups.Io <sjmills@...> wrote:

I would think that would be a fair use


Re: Mail Icon for iOS

Steve Mills
 

On Sep 28, 2018, at 00:39:24, Gerriet M. Denkmann <g@mdenkmann.de> wrote:


Well, I was thinking of the AppIcon of Mail.app. On macOS I could do:
[NSRunningApplication runningApplicationsWithBundleIdentifier: “com.apple.main”].firstObject.icon

But there seems to be no RunningApplication on iOS.

And even if: Apple might not appreciate my usage of their Mail icon.
Probably not worth the trouble.
I would think that would be a fair use - click this to send an email with Mail.app. No different than how tons of apps show icons of other apps for launching or doing actions with them. Is there no icon service sort of thing on iOS for looking up an icon by UTI, where something like com.apple.mail might be the UTI to request?

--
Steve Mills
Drummer, Mac geek


Re: Word detection without separating spaces

Jeremy Hughes
 

You could try taking the first n characters of a word (where n is 1 to maximum word length) and spell checking that string. When you a string that spell-checks, continue for the next n characters, and so on. If you get to a point where you can’t find a word for the remaining characters, backtrack and look for a longer word in the previous characters.

Some strings might have multiple answers:

findale could be find ale or fin dale

Jeremy


Re: resizeWithOldSuperviewSize not getting called on added Subview

Dave
 

This is a Mac Project.

I’ve not found anything obvious on this, so I’m trying to get to the bottom of why the auto-resizing mechanism is not working with Class that inherits from NSImageView called GameImageView. An object is created and added to the view hierarchy at run time.

The view hierarchy is actually setup in a Storyboard/NIB and looks something like this:

WindowTrackerView
GameBaseView
TopAreaView
BottomAreaView
LeftAreaView
RightAreaView
GameBoardView
GameClusterView1
GameCellView1
GameCellView2
GameCellViewN
GameClusterView2
GameCellView1
GameCellView2
GameCellViewN
GameClusterViewN
GameCellView1
GameCellView2
GameCellViewN


I am adding GameImageView to each of the GameCellView's at runtime. All the Views are now using resizeWithOldSuperviewSize to resize themselves and it works wonderfully EXCEPT then this mechanism is not working on the run-time added GameImageView’s, e.g. GameImageView ::resizeWithOldSuperviewSize never gets called, although it does get called in the GameCellView’s.

If I do this in the GameCellView:: resizeWithOldSuperviewSize method it works ok (e.g. the Image resized when I resize the window):

myCellStartPosition = [self getCellXYPosition];

myBoundingRect = self.superview.bounds;
myFrameRect = [self calculateFrameRectWithSuperViewRect:myBoundingRect];

myFrameRect.origin.x = (int) (3 + (myCellStartPosition.x * (myFrameRect.size.width + 2)));
myFrameRect.origin.y = (int) (3 + (myCellStartPosition.y * (myFrameRect.size.height + 2)));

self.frame = myFrameRect;

//**
//** Setup the Image View Frame based on the Cell’s view *********************
//**
myImageFrameRect = NSInsetRect(self.bounds,2,2);
self.pCellImageView.frame = myImageFrameRect;

e.g. if I set the the frame of the GameImageView in the Superclass it works ok. If I don’t do this expecting GameCellView:: resizeWithOldSuperviewSize to be called then the image does NOT resize, since it isn’t called!! I’m trying to understand why this doesn’t work as expected, I’m not doing anything different (apart from adding it as a subview at runtime) from the other classes in the hierarchy and they all work wonderfully.

I’ve more or less got it working, but this last part is driving me nuts, so if anyone can shed some light on what could be going wrong I’m be really grateful.

Thanks in advance.

All the Best
Dave

On 27 Sep 2018, at 20:10, Dave <dave@looktowindward.com> wrote:

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave







Re: Very short-lived Permissions in iOS

Gerriet M. Denkmann
 

On 28 Sep 2018, at 16:54, Alex Zavatone via Groups.Io <zav=mac.com@groups.io> wrote:

You can create another window and then display the auth request. When the auth is accepted or denied, dispose of the other window.
I have a strong suspicion that this is (again) a case of programmer (=me) error.
Probably the object asking for authorisation did not live long enough.

Sorry for the noise.


On Sep 28, 2018, at 12:48 AM, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

iOS 12; Xcode 10.

User clicks on a button.

2018-09-28 12:14:59.376384+0700 CLAuthorizationStatus: Not Determined
2018-09-28 12:14:59.377407+0700 asking for permission...
2018-09-28 12:15:01.242062+0700 -[AppIosDelegate applicationWillResignActive:]

A panel (alert, whatever) comes up with some text.
But less than a second later:

2018-09-28 12:15:02.163068+0700 -[AppIosDelegate applicationDidBecomeActive:]

and now my app obscures the panel, without giving me time to read it, let alone answer it.

This is not very helpful.
How can this be avoided?

Gerriet.


Re: Very short-lived Permissions in iOS

Alex Zavatone
 

You can create another window and then display the auth request. When the auth is accepted or denied, dispose of the other window.

On Sep 28, 2018, at 12:48 AM, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

iOS 12; Xcode 10.

User clicks on a button.

2018-09-28 12:14:59.376384+0700 CLAuthorizationStatus: Not Determined
2018-09-28 12:14:59.377407+0700 asking for permission...
2018-09-28 12:15:01.242062+0700 -[AppIosDelegate applicationWillResignActive:]

A panel (alert, whatever) comes up with some text.
But less than a second later:

2018-09-28 12:15:02.163068+0700 -[AppIosDelegate applicationDidBecomeActive:]

and now my app obscures the panel, without giving me time to read it, let alone answer it.

This is not very helpful.
How can this be avoided?

Gerriet.




Very short-lived Permissions in iOS

Gerriet M. Denkmann
 

iOS 12; Xcode 10.

User clicks on a button.

2018-09-28 12:14:59.376384+0700 CLAuthorizationStatus: Not Determined
2018-09-28 12:14:59.377407+0700 asking for permission...
2018-09-28 12:15:01.242062+0700 -[AppIosDelegate applicationWillResignActive:]

A panel (alert, whatever) comes up with some text.
But less than a second later:

2018-09-28 12:15:02.163068+0700 -[AppIosDelegate applicationDidBecomeActive:]

and now my app obscures the panel, without giving me time to read it, let alone answer it.

This is not very helpful.
How can this be avoided?

Gerriet.


Re: Mail Icon for iOS

Gerriet M. Denkmann
 

On 28 Sep 2018, at 01:18, Alex Zavatone via Groups.Io <zav=mac.com@groups.io> wrote:

https://developer.apple.com/design/human-interface-guidelines/ios/icons-and-images/system-icons/
This is a very helpful list indeed. Thanks a lot.


See if your desired icon is there.
Well, I was thinking of the AppIcon of Mail.app. On macOS I could do:
[NSRunningApplication runningApplicationsWithBundleIdentifier: “com.apple.main”].firstObject.icon

But there seems to be no RunningApplication on iOS.

And even if: Apple might not appreciate my usage of their Mail icon.
Probably not worth the trouble.

Gerriet.


Re: Mail Icon for iOS

Alex Zavatone
 

This should help.


See if your desired icon is there.  

There also is a font that is all icons that is made for this purpose called FontAwesome. That may also help if you can’t get what you want from the default system images.


GL.

Alex Zavatone



On Sep 27, 2018, at 4:59 AM, Gerriet M. Denkmann <g@...> wrote:

I have a UIButton “Send Mail”. Looks ok, but kind of plain.

Other apps (like Photos) have a beautiful blue Mail icon.
Is there a way to use this?

Gerriet.






resizeWithOldSuperviewSize not getting called on added Subview

Dave
 

Hi,

I’m using Manual Layout on a Mac project. The View Hierarchy is built in Interface Builder and during run time I add a subview to one of the views. However, resizeWithOldSuperviewSize is not being called on these subviews. The subview in question is a subclass of NSImageView.

I’ve explicitly set autoresizesSubviews = YES in the view that adds the subview (actually is all the views in the Hierarchy).

Anyone have half an idea why resizeWithOldSuperviewSize is not being called? The frame of the parent rectangle is definitely being set…..

All the Best
Dave


Re: Word detection without separating spaces

Sandor Szatmari
 

Yes, thanks! I have been playing with NSSpellChecker but haven’t been able to configure it with the magic sauce to get it to tokenize the way I am describing.

Sandor

On Sep 27, 2018, at 12:41, Ben Kennedy <ben-groups@zygoat.ca> wrote:

On 27 Sep 2018, at 5:21 am, Sandor Szatmari <admin.szatmari.net@gmail.com> wrote:

You know how apple apps can turn ‘itwas’ into ‘it was’ as your typing in a text field? Is there an API for this? I’d like to be able to take something like AREALLYLONGSTRING and turn it into ‘a really long string’ or ‘a_really_long_string’ or basically insert whatever separator I want.
Some quick googlage suggests that UITextChecker (iOS) and NSSpellChecker (Mac OS) might fit the bill...?

-ben




Re: Word detection without separating spaces

Ben Kennedy
 

On 27 Sep 2018, at 5:21 am, Sandor Szatmari <admin.szatmari.net@gmail.com> wrote:

You know how apple apps can turn ‘itwas’ into ‘it was’ as your typing in a text field? Is there an API for this? I’d like to be able to take something like AREALLYLONGSTRING and turn it into ‘a really long string’ or ‘a_really_long_string’ or basically insert whatever separator I want.
Some quick googlage suggests that UITextChecker (iOS) and NSSpellChecker (Mac OS) might fit the bill...?

-ben


Word detection without separating spaces

Sandor Szatmari
 

You know how apple apps can turn ‘itwas’ into ‘it was’ as your typing in a text field? Is there an API for this? I’d like to be able to take something like AREALLYLONGSTRING and turn it into ‘a really long string’ or ‘a_really_long_string’ or basically insert whatever separator I want.

Something like -(NSString*)componentsSeparatedByDictionaryWord:(NSString*)string;

Does my magical imaginary API exist? I’d imagine it’s part of autocorrection functionality…

Thanks,
Sandor
Trying hard not to reinvent the wheel


Mail Icon for iOS

Gerriet M. Denkmann
 

I have a UIButton “Send Mail”. Looks ok, but kind of plain.

Other apps (like Photos) have a beautiful blue Mail icon.
Is there a way to use this?

Gerriet.


Re: Mystery Buttons in UITableViews

Gerriet M. Denkmann
 

On 27 Sep 2018, at 09:00, Alex Zavatone via Groups.Io <zav=mac.com@groups.io> wrote:

Did you prepare the cells for reuse?

Run the app in the simulator and enable the highlight for the views. I’ll bet that as soon as you scroll the table view, some cells are getting ghost buttons appearing in them.

It that what’s happening?
No ghosts, no gremlins.

Looking at the table views again (after a good night’s sleep), I finally discovered that the prototype cell for the row with the button did *not* have:

Interaction ✔️ User Interaction Enabled

So, no big surprise that there was no user interaction (i.e. pressing of buttons) in this row.

A rather stupid mistake on my part. And sorry for the noise.


On Sep 26, 2018, at 8:58 PM, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

iOS 12, Xcode 10.

I have two subclasses of UITableViewController, and the tableView of each has a row with a UIButton.
Both subclasses look absolutely identical (I have checked this in Xcode at least a dozen times) but still:
• One button works as expected,
• but the other one does not react to tappings at all (not dims for a short time, not sends its action methods). And yes: it has valid targets and methods. Doing sendActionOn: just work fine.
But I really want the button to react to tappings.

Where should I look for an explanation?
To repeat myself: make sure to have:
Interaction ✔️ User Interaction Enabled

Gerriet.


Re: Mystery Buttons in UITableViews

Alex Zavatone
 

Did you prepare the cells for reuse?

Run the app in the simulator and enable the highlight for the views. I’ll bet that as soon as you scroll the table view, some cells are getting ghost buttons appearing in them.

It that what’s happening?

On Sep 26, 2018, at 8:58 PM, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

iOS 12, Xcode 10.

I have two subclasses of UITableViewController, and the tableView of each has a row with a UIButton.
Both subclasses look absolutely identical (I have checked this in Xcode at least a dozen times) but still:
• One button works as expected,
• but the other one does not react to tappings at all (not dims for a short time, not sends its action methods). And yes: it has valid targets and methods. Doing sendActionOn: just work fine.
But I really want the button to react to tappings.

Where should I look for an explanation?

Gerriet.




Mystery Buttons in UITableViews

Gerriet M. Denkmann
 

iOS 12, Xcode 10.

I have two subclasses of UITableViewController, and the tableView of each has a row with a UIButton.
Both subclasses look absolutely identical (I have checked this in Xcode at least a dozen times) but still:
• One button works as expected,
• but the other one does not react to tappings at all (not dims for a short time, not sends its action methods). And yes: it has valid targets and methods. Doing sendActionOn: just work fine.
But I really want the button to react to tappings.

Where should I look for an explanation?

Gerriet.


Re: NSMeasurementFormatter reversed

James Walker
 

On 9/26/18 5:12 PM, Quincey Morris wrote:
On Sep 26, 2018, at 09:44 , Gerriet M. Denkmann <g@...> wrote:

NSString *temp1 = [NSUserDefaults.standardUserDefaults stringForKey: @"AppleTemperatureUnit"];

NSString *temp2 = [ NSLocale.currentLocale objectForKey: @"kCFLocaleTemperatureUnitKey"];

FOUNDATION_EXPORT NSLocaleKey const NSLocaleTemperatureUnit;
NSString *temp3 = [ NSLocale.currentLocale objectForKey: NSLocaleTemperatureUnit];

Be careful with this. If you look at some of the Stack Overflow posts about this, it seems to be regarded as private API, and a cause for rejection by App Review.

I think the real answer is that getting the region setting for temperature is just not supported. There may not be a good, future-proof mechanism for getting the setting you want.

The first of those 3 methods does not use a private API.  But you could say that an undocumented default could break in the future.

621 - 640 of 1422