Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
VLC-iOS
Commits
9021a17d
Commit
9021a17d
authored
May 19, 2014
by
Pierre SAGASPE
Committed by
Felix Paul Kühne
May 21, 2014
Browse files
Plex:add pull to refresh
Signed-off-by:
Felix Paul Kühne
<
fkuehne@videolan.org
>
parent
c3a3b436
Changes
1
Hide whitespace changes
Inline
Side-by-side
Sources/VLCLocalPlexFolderListViewController.m
View file @
9021a17d
...
...
@@ -35,6 +35,7 @@
NSMutableArray
*
_searchData
;
UISearchBar
*
_searchBar
;
UISearchDisplayController
*
_searchDisplayController
;
UIRefreshControl
*
refreshControl
;
}
@end
...
...
@@ -94,6 +95,12 @@
_searchBar
.
delegate
=
self
;
self
.
tableView
.
tableHeaderView
=
_searchBar
;
// Active le Pull down to refresh
refreshControl
=
[[
UIRefreshControl
alloc
]
init
];
// Call the refresh function
[
refreshControl
addTarget
:
self
action
:
@selector
(
handleRefresh
)
forControlEvents
:
UIControlEventValueChanged
];
[
self
.
tableView
addSubview
:
refreshControl
];
_searchData
=
[[
NSMutableArray
alloc
]
init
];
[
_searchData
removeAllObjects
];
}
...
...
@@ -279,6 +286,13 @@
[[
_mutableObjectList
objectAtIndex
:[
self
.
tableView
indexPathForCell
:
swipedCell
].
row
]
setObject
:
tag
forKey
:
@"state"
];
}
-
(
void
)
reloadTableViewPlex
{
[
_mutableObjectList
removeAllObjects
];
_mutableObjectList
=
[
_PlexParser
PlexMediaServerParser
:
_PlexServerAddress
port
:
_PlexServerPort
navigationPath
:
_PlexServerPath
];
[
self
.
tableView
reloadData
];
}
#pragma mark - VLCLocalNetworkListCell delegation
-
(
void
)
triggerDownloadForCell
:(
VLCLocalNetworkListCell
*
)
cell
...
...
@@ -327,4 +341,20 @@
tableView
.
backgroundColor
=
[
UIColor
blackColor
];
}
#pragma mark - Refresh
-
(
void
)
handleRefresh
{
//set the title while refreshing
refreshControl
.
attributedTitle
=
[[
NSAttributedString
alloc
]
initWithString
:
@"Refresh"
];
//set the date and time of refreshing
NSDateFormatter
*
formattedDate
=
[[
NSDateFormatter
alloc
]
init
];
[
formattedDate
setDateFormat
:
@"MMM d, h:mm a"
];
NSString
*
lastupdated
=
[
NSString
stringWithFormat
:
@"Last Updated on %@"
,
[
formattedDate
stringFromDate
:[
NSDate
date
]]];
refreshControl
.
attributedTitle
=
[[
NSAttributedString
alloc
]
initWithString
:
lastupdated
];
//end the refreshing
[
refreshControl
endRefreshing
];
[
self
performSelector
:
@selector
(
reloadTableViewPlex
)
withObject
:
nil
];
}
@end
Write
Preview
Supports
Markdown
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