对所有人来说
如果您在构建Android REST应用程序时观看Google IO会话,则无论您是否需要共享数据,他们都建议使用所有三种设计模式来使用内容提供商.
如果您查看http://developer.android.com/reference/android/content/ContentProvider.html上的Content Provider类文档,他们表示如果您计划与其他应用程序共享数据,则只需使用内容提供程序.
我的应用程序不需要与其他应用程序共享任何数据,因此使用内容提供商过度杀伤?如果是这样,为什么Google IO REST视频意味着它应该在所有场景中使用?
- =更新= -
会谈在这里https://dl.google.com/googleio/2010/android-developing-RESTful-android-apps.pdf.
我有一个UIScrollView有UIImageView.我想在这上面显示引脚imageView.当我添加引脚作为子视图时ImageView,一切都很棒,除了缩放时,引脚上也会发生缩放转换.我不希望这种行为,并希望我的引脚保持不变.
因此,我选择将Pins添加到位于ImageView顶部的另一个视图,也是该视图的子视图UIScrollView.如果你想象的话,这里的想法是有一个悬浮在地图上的图层,并且不会缩放,而是在我绘制它们的地方显示引脚.
添加到图层视图时的引脚如果ImageView缩放则不会进行压缩.然而,问题变成了引脚的位置与原始x/y不匹配,因为ImageView已经进行了比例变换.
基本上这是一个带有Pins的地方的自定义地图.我试图让Pins漂浮而不是放大和缩小我的ImageView,还记得在缩放发生时我放置它们的位置.
一些代码:
scrollView = [[UIScrollView alloc] initWithFrame:viewRect];
scrollView.delegate = self;
scrollView.pagingEnabled = NO;
scrollView.scrollsToTop = NO;
[scrollView setBackgroundColor:[UIColor clearColor]];
scrollView.clipsToBounds = YES; // default is NO, we want to restrict drawing within our scrollview
scrollView.bounces = YES;
scrollView.autoresizingMask = UIViewAutoresizingFlexibleHeight;
scrollView.indicatorStyle = UIScrollViewIndicatorStyleWhite;
imageViewMap = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.png"]];
imageViewMap.userInteractionEnabled = YES;
viewRect = CGRectMake(0,0,imageViewMap.image.size.width,imageViewMap.image.size.height);
//viewRect = CGRectMake(0,0,2976,3928);
[scrollView addSubview:imageViewMap];
[scrollView setContentSize:CGSizeMake(viewRect.size.width, viewRect.size.height)]; …Run Code Online (Sandbox Code Playgroud) 对所有人来说
我有动画图像和帧动画,我正在从视图后面移动到屏幕上.TranslateAnimation完成后,我想保持结束位置,因此setFillAfter设置为true.
我的问题是TranslateAnimation完成后帧动画停止.如何重新启动或保持帧动画?
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
id="selected" android:oneshot="false">
<item android:drawable="@drawable/a" android:duration="200" />
<item android:drawable="@drawable/b" android:duration="200" />
<item android:drawable="@drawable/c" android:duration="200" />
</animation-list>
loadingView = (RelativeLayout) findViewById(R.id.loadingBar);
loadingView.setVisibility(View.VISIBLE);
loadingImage = (ImageView) loadingView.findViewById(R.id.loading);
loadingImage.setBackgroundResource(R.drawable.loading);
animateImages = (AnimationDrawable) loadingImage.getBackground();
translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
Animation.RELATIVE_TO_SELF,0.0f, Animation.RELATIVE_TO_SELF, -1.0f);
translateAnimation.setInterpolator(new AccelerateInterpolator());
translateAnimation.setDuration(2000);
translateAnimation.setFillEnabled(true);
translateAnimation.setFillAfter(true);
translateAnimation.setAnimationListener(new AnimationListener()
{
@Override
public void onAnimationStart(Animation animation)
{
// TODO Auto-generated method stub
animateImages.start();
}
@Override
public void onAnimationEnd(Animation arg0)
{
}
@Override
public void onAnimationRepeat(Animation animation) …Run Code Online (Sandbox Code Playgroud) 对所有人来说
我正在查看来自http://iphoneonrails.com/的示例项目,我看到他们使用了NSObject类并为SOAP调用添加了方法.
他们的示例项目可以从http://iphoneonrails.com/downloads/objective_resource-1.01.zip下载.
我的问题与我对以下语法缺乏了解有关,因为我还没有在iPhone项目中看到它.
有一个名为NSObject + ObjectiveResource.h的头文件,它们声明并更改NSObject以为该项目提供额外的方法.名称中的"+ ObjectiveResource.h"是否有特殊的语法,或者只是开发人员的命名约定.
最后在NSObject类中我们有以下内容
#import <Foundation/Foundation.h>
@interface NSObject (ObjectiveResource)
// Response Formats
typedef enum {
XmlResponse = 0,
JSONResponse,
} ORSResponseFormat;
// Resource configuration
+ (NSString *)getRemoteSite;
+ (void)setRemoteSite:(NSString*)siteURL;
+ (NSString *)getRemoteUser;
+ (void)setRemoteUser:(NSString *)user;
+ (NSString *)getRemotePassword;
+ (void)setRemotePassword:(NSString *)password;
+ (SEL)getRemoteParseDataMethod;
+ (void)setRemoteParseDataMethod:(SEL)parseMethod;
+ (SEL) getRemoteSerializeMethod;
+ (void) setRemoteSerializeMethod:(SEL)serializeMethod;
+ (NSString *)getRemoteProtocolExtension;
+ (void)setRemoteProtocolExtension:(NSString *)protocolExtension;
+ (void)setRemoteResponseType:(ORSResponseFormat) format;
+ (ORSResponseFormat)getRemoteResponseType;
// Finders
+ (NSArray *)findAllRemote;
+ (NSArray *)findAllRemoteWithResponse:(NSError **)aError; …Run Code Online (Sandbox Code Playgroud) android ×2
iphone ×2
animation ×1
frame ×1
io ×1
mapping ×1
objective-c ×1
rest ×1
sdk ×1
translation ×1
uiscrollview ×1
zooming ×1