[.Net10] [Proposal] [iOS] TabbedPage.AutoResizeIconsProperty#28046
[.Net10] [Proposal] [iOS] TabbedPage.AutoResizeIconsProperty#28046kubaflo wants to merge 4 commits intodotnet:net10.0from
Conversation
|
If this makes sense, then I think It would be a good idea to do something similar for shell |
|
Yes! Love it! Do we have any indication how much of a performance hit this would be? I guess another approach to circumvent that is to generate an image with the right size at compile time and add _tab or something to the name and make it use that automatically. But I guess this is fine and shouldn’t even be noticed, especially on iOS. 25 is hard coded now, can we get that size programmatically from somewhere? And isn’t there a different size for the compact mode? What will this do when you turn the iPhone to landscape? |
|
Also, could retarget to the net10.0 branch? |
Yeah, I will do it, but later, because it is easier for me to develop on net9.0 |
Hmmm that's kind of tricky because according to Apple there are a few configurations: The 25pt is almost always used, but you're right for the compact/horizontal mode it should be 18pt. I tried to find some method to get the recommended size for the current screen from Apple's API, but they don't provide devs with this :/ |
|
Apple docs for tab bar and icons: https://developer.apple.com/design/human-interface-guidelines/tab-bars |
|
@jfversluis I think I've figured it out! Now it should adjust when switching orientation and in compact mode. Check the latest commit :) Simulator.Screen.Recording.-.iPhone.16.Pro.Max.-.2025-02-26.at.20.17.27.mp4 |
|
@jfversluis I've noticed one bug with my approach. I didn't respect proportions, so all images were scaled to a square. I've added a commit that fixes it. Now everything adheres to Apple's native scaling https://developer.apple.com/design/human-interface-guidelines/tab-bars#Target-dimensions
|
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Dude you're on fire, this makes me so happy |
Yeah, I like it too. What puzzles me is whether we should do something similar for the tabbed page generated by shell? |
|
Why would we (not) do that? |
Okay, I will see what I can come up with this weekend |
f0fc6ea to
799e940
Compare
799e940 to
d97c250
Compare
Here it is :) |
|
/azp run |
This comment was marked as off-topic.
This comment was marked as off-topic.
| CGSize newSize = image.Size; | ||
|
|
||
| //https://developer.apple.com/design/human-interface-guidelines/tab-bars#Target-dimensions | ||
| bool isRegularTabBar = traitCollection.VerticalSizeClass == UIUserInterfaceSizeClass.Regular; |
There was a problem hiding this comment.
Here, can create some variables like:
bool isRegularTabBar = traitCollection.VerticalSizeClass == UIUserInterfaceSizeClass.Regular;
float targetWidth = isRegularTabBar ? 31f : 23f;
float targetHeight = isRegularTabBar ? 28f : 20f;
And then, reuse like:
if (image.Size.Width > image.Size.Height) // Wide
{
newSize.Width = targetWidth;
newSize.Height = targetWidth * image.Size.Height / image.Size.Width;
}
else if (image.Size.Width < image.Size.Height) // Tall
{
newSize.Height = targetHeight;
newSize.Width = targetHeight * image.Size.Width / image.Size.Height;
}
| bool isRegularTabBar = traitCollection.VerticalSizeClass == UIUserInterfaceSizeClass.Regular; | ||
| if (image.Size.Width > image.Size.Height) //Wide | ||
| { | ||
| newSize.Width = isRegularTabBar ? 31 : 23; |
There was a problem hiding this comment.
The link to the apple dimensions guidelines is nice, but could we include more comments associated with the numbers?
861d5b4 to
7e90052
Compare
|
@kubaflo Could you rebase and fix the conflicts? |
7e90052 to
4046576
Compare
done |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| public void TabBarIconsShouldAutoscale() | ||
| { | ||
| App.WaitForElement("Tab1"); | ||
| VerifyScreenshot(); |
|
Can you rebase and retarget net10.0 @kubaflo ? and change the base of the PR . Thanks |
3b98b6a to
bc7d157
Compare
|
Closing in favor of #29003 |




Description of Change
Maybe we can add
TabbedPage.AutoResizeIconsPropertyso that when it is set to true, the tab bar icons will be resized to Apple's recommended values grabbed from here https://developer.apple.com/design/human-interface-guidelines/tab-bars#Target-dimensions. Currently, devs have to manually rescale their images to make them look appealing to users, which is not a disaster, but I think they would appreciate us making it for themTabbedPage.AutoResizeIconsProperty
Screen.Recording.2025-02-26.at.01.21.12.mov