根据我的收集,有三类:
GET和使用POSTPOST和使用GET假设这三个案件我是否正确?如果是这样,每个案例的一些例子是什么?
我有一个没有子窗口小部件的活动,相应的xml文件是,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:focusable="true"
>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我想在活动开始时以编程方式打开软键盘.我现在尝试的是,
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if (inputMethodManager != null) {
inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
Run Code Online (Sandbox Code Playgroud)
给我一些指导.
我想在推送视图控制器时显示自定义动画:我希望实现像"扩展"动画这样的东西,这意味着新视图从给定的矩形扩展,让动画期间[100,100 220,380]全屏显示.
任何建议从哪里开始,分别是任何文档,教程,链接?:)
好的.我可以使用以下代码制作展开动画:
if ([coming.view superview] == nil)
[self.view addSubview:coming.view];
coming.view.frame = CGRectMake(160,160,0,0);
[UIView beginAnimations:@"frame" context:nil];
[UIView setAnimationDuration:4];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[coming viewWillAppear:YES];
[going viewWillAppear:YES];
coming.view.frame = CGRectMake(0, 0, 320, 480);
[going viewDidDisappear:YES];
[coming viewDidAppear:YES];
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
我的视图已正确显示,但遗憾的是导航栏未更新.有没有办法手动完成?
在示例代码中,一个函数被称为0.03秒,用于更新视图的转换.不幸的是,当推动一个时UIViewController,我无法调整视图的框架...我是吗?
iphone animation uiviewcontroller uikit uinavigationcontroller
我试图在两个活动之间建立监听器接口Act1 and Act2.Act1将开始Act2.如果发生了某些事件Act2,它会通知它Act1.问题是我正在使用Intent开始新的活动,那么Act1如何将自己指定为Act2接口的监听器?
Act1.java
public class Act1 extends ActionBarActivity implements
ActionBar.OnNavigationListener {
ActionBar actionbar;
Intent pizzaIntent;
boolean visibleFirstTime = true;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menutab);
//set actionbar here
}
@Override
public boolean onNavigationItemSelected(int arg0, long arg1)// item pos,
// itemid
{
switch (arg0) {
case 0:
if(this.visibleFirstTime == false)
{
if(pizzaIntent == null)
{
pizzaIntent = new Intent(this,Act2.class);
//how to call setChangeListener?
}
startActivity(pizzaIntent);
}
else
this.visibleFirstTime = …Run Code Online (Sandbox Code Playgroud) 根据本地测试,'this'在行渲染函数中似乎为null.因此,这阻止了我在onPress道具上绑定本地函数.
我有这个渲染块:
render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={this._renderRow}
renderHeader={this._renderHeader}
style={styles.listView} />
);
}
Run Code Online (Sandbox Code Playgroud)
和一个本地功能
_visitEntryDetail() {
console.log('test');
}
Run Code Online (Sandbox Code Playgroud)
然后行渲染
_renderRow(something) {
return (
<TouchableHighlight
style={[styles.textContainer, filestyle.container]}
onPress={this._visitEntryDetail.bind(this)} >
<View>
<Text style={filestyle.text1} >{something.detail}</Text>
<Text style={filestyle.text2} >{something.size}, {something.timestamp}</Text>
</View>
</TouchableHighlight>
);
}
Run Code Online (Sandbox Code Playgroud)
这回来了
message: null is not an object (evaluating 'this.$FileList_visitEntryDetail')"
Run Code Online (Sandbox Code Playgroud)
检查renderRow上的"this"在替换上面的代码时返回null:
_renderRow(file) {
console.log(this);
return (
<TouchableHighlight
style={[styles.textContainer, filestyle.filelistcontainer]}
>
Run Code Online (Sandbox Code Playgroud)
以下控制台输出:
RCTJSLog> null
Run Code Online (Sandbox Code Playgroud)
但是很好
render() {
console.log('inside render. this value is below me');
console.log(this);
return (
<ListView
Run Code Online (Sandbox Code Playgroud)
安慰
RCTJSLog> "inside …Run Code Online (Sandbox Code Playgroud) 我试图在回收者视图中使最后一行中心的项目水平.我正在使用GridLayoutManager以实现功能.使用setSpanSizeLookup,我想根据SO上的帖子调整最后一行的跨度大小,但遗憾的是我无法跟踪当前正在填充哪一行,因此我的逻辑无效.
我想要实现的是:
static private int NUM_OF_COLUMNS = 3;
final GridLayoutManager manager = new GridLayoutManager(getBaseActivity(), NUM_OF_COLUMNS);
manager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
int rowNum = 0;
@Override
public int getSpanSize(int position) {
int spanSize = 1;
if(position == 0)
rowNum = 0; //reset it
//check if it is last row
int numOfRows = (int) Math.ceil((double) list.size() / NUM_OF_COLUMNS);
if(rowNum == numOfRows - 1) {
//get num of items in last row
int items = list.size() - (NUM_OF_COLUMNS * rowNum); …Run Code Online (Sandbox Code Playgroud) 我知道此类错误之前已多次提出,但我没有找到我的错误的解决方案.我正在使用xcode 4.0.我下载了ASIHTTPRequest zip和复制的classes文件夹以及两个'Reachability'文件.编译后,它给了我奇怪的错误,这是我无法弄清楚的.下面我为架构i386复制了未定义符号的错误文本.
Ld /Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator/Manual.app/Manual normal i386
cd "/Users/svp/Desktop/Manual nav before pres 2"
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/llvm-gcc-4.2 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk -L/Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator -F/Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator -filelist /Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Intermediates/Manual_BeforePres2.build/Debug-iphonesimulator/Manual.build/Objects-normal/i386/Manual.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -lz -framework SystemConfiguration -framework CFNetwork -framework UIKit -framework Foundation -framework CoreGraphics -o /Users/svp/Library/Developer/Xcode/DerivedData/Manual_BeforePres2-fahkeiivemkgpubswgvzglvndszw/Build/Products/Debug-iphonesimulator/Manual.app/Manual
Undefined symbols for architecture i386:
"_UTTypeCreatePreferredIdentifierForTag", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_UTTypeCopyPreferredTagWithClass", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_kUTTagClassFilenameExtension", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
"_kUTTagClassMIMEType", referenced from:
+[ASIHTTPRequest mimeTypeForFileAtPath:] in ASIHTTPRequest.o
ld: …Run Code Online (Sandbox Code Playgroud) 我试图上传图像与android作为前端和django作为后端.
型号:
class Photo(models.Model):
title = models.CharField(max_length=255,blank=True)
photo = models.FileField(upload_to='photos')
description = models.TextField(blank=True)
uploaded = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
class Meta:
db_table = 'media_photos'
def __unicode__(self):
return '%s' % self.title
Run Code Online (Sandbox Code Playgroud)
url url的视图(r'^ photos/upload/$','upload_photo'):
def upload_photo(request):
form=PhotoForm(request.POST,request.FILES)
if request.method=='POST':
if form.is_valid():
image = request.FILES['photo']
title1 =''
new_image = Photo(title=title1,photo=image,description='')
new_image.save()
response_data=[{"success": "1"}]
return HttpResponse(simplejson.dumps(response_data), mimetype='application/json')
Run Code Online (Sandbox Code Playgroud)
现在我想从android访问这里的视图. 所以现在我上传图像的android端代码是:
public void doFileUpload(String path){
HttpURLConnection conn = null;
DataOutputStream dos = null;
DataInputStream inStream = null;
String lineEnd = "\r\n";
int …Run Code Online (Sandbox Code Playgroud) 我试图有一个最大2位小数精度的数字字符串,而其余的小数只是修剪掉而不是将它们四舍五入.例如:
I have: 123456.9964
I want: 123456.99 -> Just want to trim rest of the decimal places
我试过的是:
NSNumberFormatter *numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setNumberStyle: NSNumberFormatterDecimalStyle];
[numberFormatter setMaximumFractionDigits:2];
NSString *numberAsString = [numberFormatter stringFromNumber:[NSNumber numberWithFloat: 123456.9964]];
NSLog(@"%@", numberAsString);
Run Code Online (Sandbox Code Playgroud)
没有什么可以将舍入模式设置为"无".我还能做些什么来维护十进制样式格式以及修剪过的十进制数字?任何帮助将不胜感激.谢谢.
我知道这个问题之前已被多次询问过,但现在还没有人解决我的问题.我知道当您在项目中获得多个文件副本时会发生此错误.我试图清理构建,删除编译源中的任何LoginController.m文件,然后构建.很好 - 没有错误.当我在Complie资源中添加我的LoginController.m文件时,编译器再次给出了相同的错误.
接下来我尝试的是从Compile Sources中删除所有.m文件,成功清理和重建,并非常仔细地添加每个.m文件.再次提出同样的错误.我没有找到任何重复的文件,那么为什么会发生这种情况呢?
请有人指导我.非常感谢.
编辑: 错误是:
Ld /Users/svp/Library/Developer/Xcode/DerivedData/TryAgain-dhbbyywxclvxfodbunqysmmfefcl/Build/Products/Debug-iphonesimulator/TryAgain.app/TryAgain normal i386
cd /Users/svp/Desktop/TryAgain
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.0.sdk -L/Users/svp/Library/Developer/Xcode/DerivedData/TryAgain-dhbbyywxclvxfodbunqysmmfefcl/Build/Products/Debug-iphonesimulator -L/Users/svp/Desktop/TryAgain/TryAgain -L/Users/svp/Desktop/TryAgain/../CorePlot_1.0/Binaries/iOS -F/Users/svp/Library/Developer/Xcode/DerivedData/TryAgain-dhbbyywxclvxfodbunqysmmfefcl/Build/Products/Debug-iphonesimulator -filelist /Users/svp/Library/Developer/Xcode/DerivedData/TryAgain-dhbbyywxclvxfodbunqysmmfefcl/Build/Intermediates/TryAgain.build/Debug-iphonesimulator/TryAgain.build/Objects-normal/i386/TryAgain.LinkFileList -mmacosx-version-min=10.6 -Xlinker -objc_abi_version -Xlinker 2 -ObjC -all_load -fobjc-arc -D__IPHONE_OS_VERSION_MIN_REQUIRED=50000 -framework MediaPlayer -lz -framework AVFoundation -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework QuartzCore -framework UIKit -framework Foundation -framework CoreGraphics -lCorePlot-CocoaTouch -o /Users/svp/Library/Developer/Xcode/DerivedData/TryAgain-dhbbyywxclvxfodbunqysmmfefcl/Build/Products/Debug-iphonesimulator/TryAgain.app/TryAgain
ld: duplicate symbol _OBJC_CLASS_$_LoginController in /Users/svp/Library/Developer/Xcode/DerivedData/TryAgain-dhbbyywxclvxfodbunqysmmfefcl/Build/Intermediates/TryAgain.build/Debug-iphonesimulator/TryAgain.build/Objects-normal/i386/LoginController.o and /Users/svp/Library/Developer/Xcode/DerivedData/TryAgain-dhbbyywxclvxfodbunqysmmfefcl/Build/Intermediates/TryAgain.build/Debug-iphonesimulator/TryAgain.build/Objects-normal/i386/Navigator.o for architecture i386
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed …