This fixes an issue where the frame for the custom view can be set to the incorrect y-offset upon setting the custom frame. In iOS 11, this behavior changed, as UIBarButtonItem went from being using springs-and-struts for sizing, to using a UIStackView, and thus using Autolayout. This lead to the superview of having a frame of (0, 22, 0, 0) at the first layout pass. By moving to using NSLayoutConstaints, we can now properly size our custom view. See also: https://gist.github.com/niw/569b49648f See also: https://stackoverflow.com/questions/10988918/change-width-of-a-uibarbuttonitem-in-a-uinavigationbar
|
|
||
3 |
|
3 |
|
4 |
|
4 |
|
5 |
|
5 |
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
6 |
|
13 |
|
7 |
|
14 |
|
8 |
|
15 |
|
|
|
||
26 |
|
33 |
|
27 |
|
34 |
|
28 |
|
35 |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
29 |
|
51 |
|
30 |
|
52 |
|
31 |
|
53 |
|
32 |
|
|
|
33 |
|
|
|
|
54 |
|
|
|
55 |
|
|
34 |
|
56 |
|
35 |
|
57 |
|
36 |
|
58 |
|
|
|
||
38 |
|
60 |
|
39 |
|
61 |
|
40 |
|
62 |
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
|
63 |
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
44 |
|
67 |
|
45 |
|
68 |
|
46 |
|
69 |
|