我有一个视图控制器,具有表格视图和表格单元格模板的单独笔尖.单元格模板有一些按钮.我想访问按钮单击以及在我已定义表视图的视图控制器内单击的单元格的索引.
所以,我有ViewController.h和ViewController.m在那里我有UITableView和TableTemplate.h,TableTemplate.m和TableTemplate.xib在那里我有定义的笔尖.我想要单元格索引的按钮单击事件ViewController.m.
有什么帮助,我该怎么办?
我正在做一个动画来显示许多图像,ImageSwitcher但我被困在设置图像ImageSwitcher.
这是我的xml中的imageswitcher.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:src="@drawable/logo" />
<ImageSwitcher
android:id="@+id/switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ImageSwitcher>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的代码
setContentView(R.layout.main_screen);
final int[] imgs = {R.drawable.m1,
R.drawable.m2,
R.drawable.m3,
R.drawable.m4,
R.drawable.m5,
R.drawable.m6};
imgswitcher = (ImageSwitcher) findViewById(R.id.switcher);
imgswitcher.postDelayed(new Runnable()
{
int index = 0;
@Override
public void run()
{
imgswitcher.setImageResource(imgs[index]);
if(index==(imgs.length-1))
index = 0;
else
index++;
imgswitcher.postDelayed(this, 1000);
}
}, 1000);
Run Code Online (Sandbox Code Playgroud)
我在网上得到错误" imgswitcher.setImageResource(imgs[index]);"
错误
11-13 15:08:34.574: E/AndroidRuntime(5258): FATAL EXCEPTION: main
11-13 …Run Code Online (Sandbox Code Playgroud) 我开发了一个iPad应用程序,我希望屏幕永远不会睡觉或锁定.我想让应用程序运行时屏幕亮起.
在android中有一个屏幕和唤醒锁处理相同,但我无法找到相同的IOS.
我猜它将是Project或target中的一些设置.请帮忙.
我正在使用AvCapture会话在相机屏幕上添加cutom叠加.我添加了一个AvCaptureVidePreview图层
AvCaptureVideoPreviewLayer*layer = [[AvCaptureVideoPreviewLayer alloc] iniWithSession:session];
layer.frame = self.view.layer.bounds;
Run Code Online (Sandbox Code Playgroud)
但在iPhone 4S的情况下,相机预览不是全屏.它在iPhone 5中运行良好.
我有以下代码,它采用NSString并返回NSDate.我已经从一个完全正常运行的项目中复制了这个代码 - 但是有些如何给出错误的输出
- (NSDate *)dateFromString:(NSString *)date
{
static NSDateFormatter *dateFormatter;
if (!dateFormatter)
{
dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"dd-MM-yyyy"];
}
NSLog(@"Date: %@ Formatted: %@",date,[dateFormatter dateFromString:date]);
return [dateFormatter dateFromString:date];
}
Run Code Online (Sandbox Code Playgroud)
输出来自日志:
Date: 07-01-2014 Formatted: 2014-01-06 18:30:00 +0000
Date: 24-01-2014 Formatted: 2014-01-23 18:30:00 +0000
Date: 06-01-2014 Formatted: 2014-01-05 18:30:00 +0000
Date: 15-01-2014 Formatted: 2014-01-14 18:30:00 +0000
Date: 22-01-2014 Formatted: 2014-01-21 18:30:00 +0000
Date: 31-01-2014 Formatted: 2014-01-30 18:30:00 +0000
Date: 14-01-2014 Formatted: 2014-01-13 18:30:00 +0000
Date: 30-01-2014 Formatted: 2014-01-29 18:30:00 +0000 …Run Code Online (Sandbox Code Playgroud) 我在 ios 上有谷歌地图 sdk 并启用了 userlocation = yes。我想在他移动时通过 GPS 获取用户位置。我在文档中找不到任何在用户不断移动时返回位置更新的方法。我想让我的用户保持在屏幕的中心,然后使用这些位置不断更新相机。
这有什么要点吗?有一种方法 didchangecameraposition 会在我在地图上应用手势时更新,但不会在 gps 更新时更新。
ios ×5
objective-c ×2
android ×1
drawable ×1
gmsmapview ×1
google-maps ×1
gps ×1
iphone ×1
nsdate ×1
uibutton ×1
uitableview ×1