我想将视图控制器推入堆栈,然后弹出第一个推动新控制器的控制器.
-(void) someMethod {
MegaSuperAwesomeViewController *tempVC = [[MegaSuperAwesomeViewController alloc] init];
[self.navigationController pushViewController:tempVC animated:YES];
[tempVC release];
// pop this VC, how?
}
Run Code Online (Sandbox Code Playgroud)
编辑:事实证明,一旦完成新的VC,我可以弹出2个视图控制器.仍然不是我想要的,但它的确有效.缺点是我需要设置一个标志来指示覆盖的视图已完成.
我想知道在VB.NET中检查可分性的最快方法是什么.
我尝试了以下两个功能,但我觉得好像有更有效的技术.
Function isDivisible(x As Integer, d As Integer) As Boolean
Return Math.floor(x / d) = x / d
End Function
Run Code Online (Sandbox Code Playgroud)
我提出的另一个:
Function isDivisible(x As Integer, d As Integer) As Boolean
Dim v = x / d
Dim w As Integer = v
Return v = w
End Function
Run Code Online (Sandbox Code Playgroud)
这是一种更实用的方法吗?
我对Android中的ComponentName类有点困惑.
有不同的方法来获取组件名称对象,但我不知道何时使用哪个...以及为什么!
例:
de.zordid.sampleappde.zordid.sampleapp.widget.WidgetProvider运用
ComponentName cn = new ComponentName("de.zordid.sampleapp.widget",
"WidgetProvider");
Run Code Online (Sandbox Code Playgroud)
我得到了这个组件信息:ComponentInfo{de.zordid.sampleapp.widget/WidgetProvider},但我无法使用它 - 组件未知!但是JavaDoc说我应该给那个包中的包和类 - 这就是我做的,不是吗?
运用
ComponentName cn = new ComponentName(context, WidgetProvider.class);
Run Code Online (Sandbox Code Playgroud)
产量ComponentInfo{de.zordid.sampleapp/de.zordid.sampleapp.widget.WidgetProvider}- 而且工作正常!!
甚至还有另一种获取ComponentName的方法 - 通过上下文和字符串.应该在何时何地使用哪一个?
谢谢!
我正在设计一个类图(静态结构),并希望包含一些枚举类.但是,我似乎找不到合适的方式来表示这一点.有任何想法吗?
我有扩展的自定义控件DataGrid.它被称为ExtendedDataGrid.我希望为它提供样式ExtendedDataGrid与DataGrids样式相同,除非它更改模板.我尝试过这样的事情:
<Style TargetType="{x:Type MyControls:ExtendedDataGrid}" BasedOn="{StaticResource {x:Type DataGrid}}">
<Setter Property="Template">
...
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
但它说没有找到资源.
所以我尝试:
<Style TargetType="{x:Type MyControls:ExtendedDataGrid}" BasedOn="{StaticResource {ComponentResourceKey ResourceId=DataGridStyle, TypeInTargetAssembly={x:Type DataGrid}}}">
<Setter Property="Template">
...
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
但它也行不通......那我该怎么办?
什么是Collada场景图?
我可以拍摄一个我从Google 3D仓库下载并以某种方式将其转换为Collada场景图的场景吗?
该过程是否以某种方式分割场景?
我想在内部缓存目录中创建.nomedia文件,我将存储图像并尝试以下内容.
File dir = getCacheDir();
File output = new File(dir, ".nomedia");
boolean fileCreated = output.createNewFile();
Run Code Online (Sandbox Code Playgroud)
当我尝试这个fileCreated是false并且文件没有被创建.如果我使用没有点的nomedia文件被创建,但这没有用,因为MediaScanner正在查看.nomedia文件是否存在.
我还尝试使用FileOutputStream并在文件中写入数据,以防因为我只创建了一个空文件,但这也不起作用.
任何人都知道为什么会失败?
有没有人设法让cocos-2d的手势识别工作?
我在这里读了一篇声称已经实现的帖子,在这里:http://www.cocos2d-iphone.org/forum/topic/8929
我在这里从git hub修补:https://github.com/xemus/cocos2d-GestureRecognizers/blob/master/README
我做了一个子类CCSprite(它的子类CCNode):
-(id) initWithTexture:(CCTexture2D*)texture rect:(CGRect)rect {
if( (self=[super initWithTexture:texture rect:rect]) )
{
CCGestureRecognizer* recognizer;
recognizer = [CCGestureRecognizer
CCRecognizerWithRecognizerTargetAction:[[[UITapGestureRecognizer alloc]init] autorelease]
target:self
action:@selector(tap:node:)];
[self addGestureRecognizer:recognizer];
}
return self;
}
Run Code Online (Sandbox Code Playgroud)
代表方法:
- (void) swipe:(UIGestureRecognizer*)recognizer node:(CCNode*)node
{
NSLog(@" I never get called :( ");
}
Run Code Online (Sandbox Code Playgroud)
我的点击事件永远不会被调用.
有人有这个工作吗?手动进行手势识别以进行滑动检测有多难?
我尝试了2000-2001的几个组件,但它们都不适用于win7.我该怎么做?