小编sha*_*sha的帖子

sencha隐藏显示按钮

嗨,我是sencha的新手,我试图了解一些事情在sencha architect/sencha touch中是如何工作的.

我找到了一个项目http://miamicoder.com/2012/how-to-create-a-sencha-touch-2-app-part-1/ ,我试着在建筑师中做到这一点.

此时我尝试将工具栏放在我的应用程序之上.我有一些按钮在我的卡之间切换.

我想要进入我的第一个屏幕的按钮开始隐藏所以当我在我的第二个屏幕时看起来像回来.我为我的按钮设置了事件

this.setActiveItem(0);
Run Code Online (Sandbox Code Playgroud)

我试过

Ext.select("#mybutton1").hidden = true;
mybutton1.setVisible(false);
Run Code Online (Sandbox Code Playgroud)

但他们不工作......任何想法?

如果有人有关于一切的任何教程/示例,请建议... thanx

extjs sencha-touch sencha-touch-2 sencha-architect

1
推荐指数
1
解决办法
7857
查看次数

循环遍历Json数据存储区extjs

我需要循环遍历Json数据存储并收集所有值.最后,它应该在警报窗口中显示所有价格的总金额.我不知道如何循环遍历Json数据stoe,我感兴趣的是如果有更快或更简单的方法来做到这一点.我的想法是:

var myStore = new Ext.data.Store({
    id: 'ID_Store',
    proxy: new Ext.data.HttpProxy({
        url: 'get.php',
        method: 'POST'
    }),
    baseParams: {
        task: "LIST"
    },
    reader: new Ext.data.JsonReader({
        root: 'results',
        totalProperty: 'total',
        id: 'id'
    }, [{
        name: 'IDbook',
        type: 'int',
        mapping: 'id_book'
    }, {
        name: 'price',
        type: 'int',
        mapping: 'price'
    }])
});

var sum = 0;

myStore.load();
myStore.on('load', function () {
    for (var i = 0; i < myStore.getTotalCount(); i++) {
        sum = sum + myStore.price[i];
    }
});

alert("total sum is:", sum);
Run Code Online (Sandbox Code Playgroud)

JSON是:

{success:true}{total:5,results:[{"id_book":"1","price":"10},{"id_book":"2","price":"15"},{"id_book":"3","price":"5"},{"id_book":"4","price":"7"},{"id_book":"5","price":"30"}]}
Run Code Online (Sandbox Code Playgroud)

javascript extjs

1
推荐指数
1
解决办法
9839
查看次数

1
推荐指数
1
解决办法
2599
查看次数

如何按字符包装UILabel中的文本

我的UILabel应该显示由角色包裹的文本,无论那里有多少个单词.

UILabel *lbl = [[UILabel alloc] initWithFrame:CGRectMake(0, 50, 130, 500)];
lbl.lineBreakMode = NSLineBreakByCharWrapping;
lbl.text = @"Petter Fergusson";
lbl.font = [UIFont fontWithName:@"Oxygen-Bold" size:16];
[self.view addSubview:lbl];
Run Code Online (Sandbox Code Playgroud)

大概我想要这个:

+--------------+
|Petter        |
|Fergusson     |
+--------------+
Run Code Online (Sandbox Code Playgroud)

是这样的:

+--------------+
|Petter Ferguss|
|on            |
+--------------+
Run Code Online (Sandbox Code Playgroud)

我怎么能做到这一点?

cocoa-touch objective-c ios

1
推荐指数
1
解决办法
1094
查看次数

包含在UIPopoverController中的UINavigationBar外观代理

我正在做一些应该在iOS7和8中工作的东西,但由于某些原因它没有.我想通过外观代理自定义导航栏属性,并希望它应用于所有导航栏甚至是里面的导航栏UIPopover.

所以,第一步我做以下事情:

UINavigationBar *appearance = [UINavigationBar appearance];
appearance.barTintColor = [UIColor redColor];
appearance.titleTextAttributes = @{
    NSForegroundColorAttributeName: [UIColor yellowColor]
};
Run Code Online (Sandbox Code Playgroud)

这应该使所有导航栏红色带黄色标题.适用于iOS8.主要在iOS7中工作.出于某种原因,当在UIPopoverController中呈现视图控制器时 - 它获得默认外观.

这就是我如何呈现popover(没什么特别的 - 几乎标准的示例代码):

UIViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"vc2"];
vc.title = @"View Controller 2";
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];
self.popover = [[UIPopoverController alloc] initWithContentViewController:nav];
[self.popover presentPopoverFromRect:CGRectMake(100, 100, 100, 100) inView:self.view permittedArrowDirections:0 animated:YES];
Run Code Online (Sandbox Code Playgroud)

好的,所以我决定尝试appearanceWhenContainedIn明确地设置它的外观.在初始外观自定义中添加了以下代码:

appearance = [UINavigationBar appearanceWhenContainedIn:[UIPopoverController class], nil];
appearance.barTintColor = [UIColor greenColor];
appearance.titleTextAttributes = @{
    NSForegroundColorAttributeName: [UIColor blueColor]
};
Run Code Online (Sandbox Code Playgroud)

现在.出于某种原因,最后一个代码不会影响任何内容.在iOS8中,UIPopoverControllers中的导航栏仍然是红色+黄色,而不是绿色+蓝色,而iOS7仍然使用默认外观.

我在这做错了什么?

以下是测试项目的链接:https: …

cocoa-touch objective-c ios uiappearance

1
推荐指数
1
解决办法
1497
查看次数