NSString
*
sizeType;
float
availableDisk;
NSArray
*
paths =
NSSearchPathForDirectoriesInDomains(
NSDocumentDirectory, NSUserDomainMask, YES
)
;
struct
statfs tStats;
statfs(
[
[
paths lastObject]
cString]
, &
tStats)
;
availableDisk =
(
float
)
(
tStats.f_bavail *
tStats.f_bsize)
;
if
(
availableDisk > 1024
)
{
availableDisk =
availableDisk /
1024
;
sizeType =
@
" KB"
;
}
if
(
availableDisk > 1024
)
{
availableDisk =
availableDisk /
1024
;
sizeType =
@
" MB"
;
}
if
(
availableDisk > 1024
)
{
availableDisk =
availableDisk /
1024
;
sizeType =
@
" GB"
;
}
diskSpaceLbl.text =
[
[
@
"Available Disk Space: "
stringByAppendingFormat:
@
"%.2f"
, availableDisk]
stringByAppendingString:
sizeType]
;
IPHONE Disk
最新推荐文章于 2024-08-16 11:40:47 发布