Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLC-iOS
Commits
01a105d7
Commit
01a105d7
authored
Oct 27, 2015
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sidebar menu: simplify autolayout code
parent
ea4ef8da
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
25 deletions
+12
-25
Sources/VLCSidebarViewCell.m
Sources/VLCSidebarViewCell.m
+3
-22
Sources/VLCWiFiUploadTableViewCell.m
Sources/VLCWiFiUploadTableViewCell.m
+9
-3
No files found.
Sources/VLCSidebarViewCell.m
View file @
01a105d7
...
...
@@ -14,32 +14,13 @@
@implementation
VLCSidebarViewCell
-
(
id
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
-
(
id
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
if
((
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
]))
{
self
.
clipsToBounds
=
YES
;
self
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
selectedBackgroundView
=
[[
UIView
alloc
]
init
];
self
.
contentView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
self
.
imageView
.
contentMode
=
UIViewContentModeCenter
;
self
.
textLabel
.
font
=
[
UIFont
systemFontOfSize
:([
UIFont
systemFontSize
]
*
1
.
2
f
)];
self
.
textLabel
.
shadowOffset
=
CGSizeMake
(
0
.
0
f
,
1
.
0
f
);
self
.
textLabel
.
shadowColor
=
[
UIColor
VLCDarkTextShadowColor
];
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
textLabel
.
textColor
=
[
UIColor
whiteColor
];
self
.
textLabel
.
adjustsFontSizeToFitWidth
=
YES
;
self
.
textLabel
.
minimumScaleFactor
=
0
.
5
f
;
self
.
textLabel
.
lineBreakMode
=
NSLineBreakByTruncatingTail
;
UILabel
*
textLabel
=
self
.
textLabel
;
textLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
UIImageView
*
imageView
=
self
.
imageView
;
imageView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
NSDictionary
*
dict
=
NSDictionaryOfVariableBindings
(
textLabel
,
imageView
);
[
self
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"H:|[imageView(50)]-==8-[textLabel]|"
options
:
0
metrics
:
0
views
:
dict
]];
[
self
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"V:|[imageView(50)]|"
options
:
0
metrics
:
0
views
:
dict
]];
[
self
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"V:|[textLabel]|"
options
:
0
metrics
:
0
views
:
dict
]];
}
return
self
;
}
...
...
Sources/VLCWiFiUploadTableViewCell.m
View file @
01a105d7
...
...
@@ -60,7 +60,7 @@
[
self
.
titleLabel
sizeToFit
];
self
.
clipsToBounds
=
YES
;
self
.
backgroundColor
=
[
UIColor
clear
Color
];
self
.
backgroundColor
=
[
UIColor
VLCMenuBackground
Color
];
self
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
self
.
uploadAddressLabel
=
[
UILabel
new
];
...
...
@@ -84,17 +84,23 @@
{
UIView
*
spacer1
=
[
UIView
new
];
UIView
*
spacer2
=
[
UIView
new
];
UIView
*
spacer3
=
[
UIView
new
];
UIView
*
spacer4
=
[
UIView
new
];
spacer1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
spacer2
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
spacer3
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
spacer4
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
contentView
addSubview
:
spacer1
];
[
self
.
contentView
addSubview
:
spacer2
];
[
self
.
contentView
addSubview
:
spacer3
];
[
self
.
contentView
addSubview
:
spacer4
];
NSDictionary
*
dict
=
NSDictionaryOfVariableBindings
(
_titleLabel
,
_uploadAddressLabel
,
_serverOnButton
,
spacer1
,
spacer2
);
NSDictionary
*
dict
=
NSDictionaryOfVariableBindings
(
_titleLabel
,
_uploadAddressLabel
,
_serverOnButton
,
spacer1
,
spacer2
,
spacer3
,
spacer4
);
[
self
.
contentView
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"H:|[_serverOnButton(50)]-==8-[_titleLabel]"
options
:
0
metrics
:
0
views
:
dict
]];
[
self
.
contentView
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"H:|[_serverOnButton(50)]-==8-[_uploadAddressLabel]"
options
:
0
metrics
:
0
views
:
dict
]];
[
self
.
contentView
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"V:|[spacer1][_titleLabel]-==0-[_uploadAddressLabel(>=0)][spacer2(==spacer1)]|"
options
:
0
metrics
:
0
views
:
dict
]];
[
self
.
contentView
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"V:|[_serverOnButton(50)]|"
options
:
0
metrics
:
0
views
:
dict
]];
[
self
.
contentView
addConstraints
:[
NSLayoutConstraint
constraintsWithVisualFormat
:
@"V:|[
spacer3][
_serverOnButton(50)]
[spacer4]
|"
options
:
0
metrics
:
0
views
:
dict
]];
}
-
(
void
)
netReachabilityChanged
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment