Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
yh_sdwebimage
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
DreamPiggy
7 years ago
Commit
7996b0dac86b31da8458cb654fbaa1b649392e61
1 parent
634e4f45
Update macOS demo to add a clear cache button using NSButton category
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
3 deletions
Examples/SDWebImage OSX Demo/Assets.xcassets/Contents.json
Examples/SDWebImage OSX Demo/Base.lproj/Main.storyboard
Examples/SDWebImage OSX Demo/ViewController.m
Examples/SDWebImage OSX Demo/Assets.xcassets/Contents.json
0 → 100644
View file @
7996b0d
{
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
...
...
Examples/SDWebImage OSX Demo/Base.lproj/Main.storyboard
View file @
7996b0d
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document
type=
"com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"10117"
systemVersion=
"15F34"
targetRuntime=
"MacOSX.Cocoa"
propertyAccessControl=
"none"
useAutolayout=
"YES"
initialViewController=
"B8D-0N-5wS"
>
<?xml version="1.0" encoding="UTF-8"?>
<document
type=
"com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB"
version=
"3.0"
toolsVersion=
"13771"
targetRuntime=
"MacOSX.Cocoa"
propertyAccessControl=
"none"
useAutolayout=
"YES"
initialViewController=
"B8D-0N-5wS"
>
<dependencies>
<deployment
identifier=
"macosx"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.CocoaPlugin"
version=
"10117"
/>
<plugIn
identifier=
"com.apple.InterfaceBuilder.CocoaPlugin"
version=
"13771"
/>
<capability
name=
"documents saved in the Xcode 8 format"
minToolsVersion=
"8.0"
/>
</dependencies>
<scenes>
<!--Application-->
...
...
@@ -656,6 +657,9 @@
<windowPositionMask
key=
"initialPositionMask"
leftStrut=
"YES"
rightStrut=
"YES"
topStrut=
"YES"
bottomStrut=
"YES"
/>
<rect
key=
"contentRect"
x=
"196"
y=
"240"
width=
"480"
height=
"400"
/>
<rect
key=
"screenRect"
x=
"0.0"
y=
"0.0"
width=
"1680"
height=
"1027"
/>
<connections>
<outlet
property=
"delegate"
destination=
"B8D-0N-5wS"
id=
"1ov-0o-Na3"
/>
</connections>
</window>
<connections>
<segue
destination=
"XfG-lQ-9wD"
kind=
"relationship"
relationship=
"window.shadowedContentViewController"
id=
"cq2-FE-JQM"
/>
...
...
@@ -675,23 +679,36 @@
<subviews>
<imageView
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"nbD-Cx-g7b"
>
<rect
key=
"frame"
x=
"20"
y=
"252"
width=
"204"
height=
"128"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMinY=
"YES"
/>
<imageCell
key=
"cell"
refusesFirstResponder=
"YES"
alignment=
"left"
imageScaling=
"proportionallyDown"
id=
"vAn-1d-apO"
/>
</imageView>
<imageView
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"kv0-67-hkh"
>
<rect
key=
"frame"
x=
"256"
y=
"252"
width=
"204"
height=
"128"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMinY=
"YES"
/>
<imageCell
key=
"cell"
refusesFirstResponder=
"YES"
alignment=
"left"
imageScaling=
"proportionallyDown"
id=
"f0P-c9-GMe"
/>
</imageView>
<imageView
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"JIp-Or-vBM"
>
<rect
key=
"frame"
x=
"20"
y=
"116"
width=
"204"
height=
"128"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMinY=
"YES"
/>
<imageCell
key=
"cell"
refusesFirstResponder=
"YES"
alignment=
"left"
imageScaling=
"proportionallyDown"
id=
"NJq-m3-LlB"
/>
</imageView>
<imageView
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"khI-tY-l0M"
>
<rect
key=
"frame"
x=
"256"
y=
"116"
width=
"204"
height=
"128"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMinY=
"YES"
/>
<imageCell
key=
"cell"
refusesFirstResponder=
"YES"
alignment=
"left"
imageScaling=
"proportionallyDown"
id=
"WbV-Do-9qy"
/>
</imageView>
<button
fixedFrame=
"YES"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"NqE-Zi-qhY"
>
<rect
key=
"frame"
x=
"212"
y=
"17"
width=
"56"
height=
"31"
/>
<autoresizingMask
key=
"autoresizingMask"
flexibleMaxX=
"YES"
flexibleMinY=
"YES"
/>
<buttonCell
key=
"cell"
type=
"bevel"
title=
"Clear"
bezelStyle=
"regularSquare"
alignment=
"center"
borderStyle=
"border"
imageScaling=
"proportionallyUpOrDown"
inset=
"2"
id=
"OYN-fG-Plb"
>
<behavior
key=
"behavior"
pushIn=
"YES"
changeContents=
"YES"
lightByContents=
"YES"
/>
<font
key=
"font"
metaFont=
"system"
/>
</buttonCell>
</button>
</subviews>
</view>
<connections>
<outlet
property=
"clearCacheButton"
destination=
"NqE-Zi-qhY"
id=
"eoz-cU-wWs"
/>
<outlet
property=
"imageView1"
destination=
"nbD-Cx-g7b"
id=
"t2R-8w-ybH"
/>
<outlet
property=
"imageView2"
destination=
"kv0-67-hkh"
id=
"i4k-5c-bno"
/>
<outlet
property=
"imageView3"
destination=
"JIp-Or-vBM"
id=
"Qcf-og-59T"
/>
...
...
Examples/SDWebImage OSX Demo/ViewController.m
View file @
7996b0d
...
...
@@ -16,6 +16,7 @@
@property
(
weak
)
IBOutlet
NSImageView
*
imageView2
;
@property
(
weak
)
IBOutlet
NSImageView
*
imageView3
;
@property
(
weak
)
IBOutlet
NSImageView
*
imageView4
;
@property
(
weak
)
IBOutlet
NSButton
*
clearCacheButton
;
@end
...
...
@@ -36,6 +37,20 @@
self
.
imageView4
.
wantsLayer
=
YES
;
self
.
imageView4
.
sd_imageTransition
=
SDWebImageTransition
.
fadeTransition
;
[
self
.
imageView4
sd_setImageWithURL
:[
NSURL
URLWithString
:
@"http://s3.amazonaws.com/fast-image-cache/demo-images/FICDDemoImage001.jpg"
]
placeholderImage
:
nil
options
:
SDWebImageForceTransition
];
self
.
clearCacheButton
.
target
=
self
;
self
.
clearCacheButton
.
action
=
@selector
(
clearCacheButtonClicked
:
);
[
self
.
clearCacheButton
sd_setImageWithURL
:[
NSURL
URLWithString
:
@"https://png.icons8.com/color/100/000000/delete-sign.png"
]];
[
self
.
clearCacheButton
sd_setAlternateImageWithURL
:[
NSURL
URLWithString
:
@"https://png.icons8.com/color/100/000000/checkmark.png"
]];
}
-
(
void
)
clearCacheButtonClicked
:
(
NSResponder
*
)
sender
{
NSButton
*
button
=
(
NSButton
*
)
sender
;
button
.
state
=
NSControlStateValueOn
;
[[
SDImageCache
sharedImageCache
]
clearMemory
];
[[
SDImageCache
sharedImageCache
]
clearDiskOnCompletion
:
^
{
button
.
state
=
NSControlStateValueOff
;
}];
}
-
(
void
)
setRepresentedObject
:
(
id
)
representedObject
{
...
...
Please
register
or
login
to post a comment