我正在使用下面的代码来保存图像 NSDocumentDirectory
-(BOOL)saveImage:(UIImage *)image name:(NSString *)name{
NSString *dir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *path = [NSString pathWithComponents:[NSArray arrayWithObjects:dir, name, nil]];
BOOL ok = [[NSFileManager defaultManager] createFileAtPath:path contents:nil attributes:nil];
if (!ok) {
NSLog(@"Error creating file %@", path);
}
else {
NSFileHandle* myFileHandle = [NSFileHandle fileHandleForWritingAtPath:path];
[myFileHandle writeData:UIImagePNGRepresentation(image)];
[myFileHandle closeFile];
}
return ok;
}
Run Code Online (Sandbox Code Playgroud)
名称通常是下载图像的URL.
文件名的长度是否有约束?你知道有时网址可能超长...
谢谢
我想更改a的默认动画ProgressBar,所以我在主题中添加了自定义样式:
<style name="ProgressTheme" parent="@android:style/Widget.ProgressBar.Large">
<item name="android:indeterminateDrawable">@drawable/spinner_holo_light</item>
</style>
Run Code Online (Sandbox Code Playgroud)
我ProgressBar在以下内容中调用此样式:
<ProgressBar
android:id="@+id/loadingProgressBar"
style="@style/ProgressTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Run Code Online (Sandbox Code Playgroud)
问题在于spinner_holo_light.xml:
如果我使用以下内容,一切都可以在os 3.0+的设备上正常工作,但进度不会在旧的os版本上旋转:
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_76_inner_holo"
android:fromDegrees="720"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0" />
Run Code Online (Sandbox Code Playgroud)
但是,如果我使用animate-rotate相反,动画适用于每个操作系统版本,但结果是一个非常滞后的动画.
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/spinner_76_inner_holo"
android:fromDegrees="720"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="0" />
Run Code Online (Sandbox Code Playgroud)
你怎么看待这件事?我在这里做错了吗?
我有这个问题,我在添加UIActivityIndicatorView一个UIScrollView; 一切都运行正常,除非它UIScrollView滚动,否则它不会开始旋转.
任何人都可以帮我解决这个问题吗?
谢谢.
这是一些代码:
UIActivityIndicatorView *loaderActivity = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
loaderActivity.center = CGPointMake(87/2,y+56/2);
loaderActivity.tag=tag;
[mainScrollView addSubview:loaderActivity];
[loaderActivity startAnimating];
[loaderActivity release];
Run Code Online (Sandbox Code Playgroud) 我有这个时间以毫秒为单位,我在XML Feed中收到,我需要以任何适当的形式显示这个时间,任何人都可以理解.
任何人都可以指导我如何实现这种行为?
谢谢.
注意:我获得的millis时间是在UNIX时间.
iphone ×3
objective-c ×2
android ×1
animation ×1
nsdate ×1
progress-bar ×1
rotation ×1
time ×1