我在我的项目中使用TTLauncherView.要拥有自定义导航栏背景,我已在我的应用委托中将UINavigationBar子类化.这很好用,所有导航栏现在都有这种自定义样式.
@implementation UINavigationBar (CustomNavBarBG)
-(void)drawRect:(CGRect)rect{
UIImage *image = [UIImage imageNamed:@"navbar_s.png"];
[image drawInRect:self.bounds];
}
@end
Run Code Online (Sandbox Code Playgroud)
浏览视图时,标题会显示在栏的中间.但是在主屏幕的导航栏上,启动器,我想要一个图像而不是标题.这可能吗?
怎么实现呢?
根据这个描述,我刚刚创建了一个九补丁图像.我把它命名为androidRow.9.png.
当我将其复制到res/drawable文件夹时,我收到一个错误
res\drawable\androidRow.9.png: Invalid file name: must contain only [a-z0-9_.]
Run Code Online (Sandbox Code Playgroud)
我怎样才能解决这个问题?
我想实现类似于ibm.com上的标题效果的效果.标题本身是固定的.向下滚动时标题会变小.向后滚动时,它会达到正常高度.
这是我尝试的方式:
$(document).ready(function() {
$(window).scroll(function(e){
var scrollTop = $(window).scrollTop();
if(scrollTop > 50){
$('.main_nav').animate({
height:"30px"
});
}
});
});
Run Code Online (Sandbox Code Playgroud)
这使得标题变小.但是我怎样才能将它设置回正常高度呢?还有其他想法吗?
我有以下网站结构
<div id="movies">
<a href="">
<div>content</div>
</a>
<a href="">
<div>content</div>
</a>
...
</div>
Run Code Online (Sandbox Code Playgroud)
a tags内部最多可以有50个#movies.如果用户请求,我想只显示10并显示另外10个.
所以我提出了以下jquery代码.
var count = $("#movies a").length;
if(count > 10){
for(i = 11; i <= count; i++){
$('#movies a:nth-child('+i+')').hide();
}
$('#more').append('<a>show more</a>');
}
$('#more a').click(function(){
var hidden = $("#movies a").filter(":hidden");
var count = 0;
for(element in hidden){
if(count <= 10){
element.show();
}
}
});
Run Code Online (Sandbox Code Playgroud)
但这给了我Uncaught TypeError: Object 0 has no method 'show'.有什么想法吗?我需要更改/添加什么来使这个想法有效?
我创建了一个defaultcontroller,如下所示
namespace Mytest\VameBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends Controller
{
public function indexAction()
{
return $this->redirect($this->generateUrl('home'));
}
public function myactionAction($name)
{
return new Response('<html><body>'.$name.'</body></html>');
}
Run Code Online (Sandbox Code Playgroud)
}
路由文件如下所示.
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
$collection = new RouteCollection();
$collection->add('name', new Route('/vame',array(
'_controller' => 'MytestVameBundle:Default:index',
)));
$collection->add('home', new Route('/vame/{name}',array(
'_controller' => 'MytestVameBundle:Default:myaction',
'name' => 'hhhhhhhhhh',
Run Code Online (Sandbox Code Playgroud)
)));
return $collection;
Run Code Online (Sandbox Code Playgroud)
它显示以下错误
页面未正确重定向
我想要做的是一旦使用索引操作调用默认控制器,它将使用一个参数重定向到myaction Action.
所以请任何帮助......
模式例如:
L(IP)-P(F)-2(014)
Run Code Online (Sandbox Code Playgroud)
更多例子:
B-G-2
BI-GH-1245
HH-X-124
Run Code Online (Sandbox Code Playgroud)
括号中的字符是可选的.第一个(最多3个字符,最小1个)和第二个部分(最多2个字符,最小1个)仅由字母组成.第三部分(最多4.分钟1)仅由数字组成.部件用" - "分隔.
任何关于这个正则表达式的想法是什么样的?
我正在使用引导程序表单主题。这是我的 fields.html.twig 表单模板:
{% block form_row %}
{% spaceless %}
<div class="form-group {% if errors|length > 0 %}has-error{% endif %}">
{{ form_label(form, label|default(null), { 'label_attr': {'class': 'control-label'} }) }}
{{ form_errors(form) }}
{% set class='' %}
{% if attr.class is defined %}
{% set class = attr.class %}
{% endif %}
{{ form_widget(form, { 'attr': {'class': 'form-control ' ~ class} }) }}
</div>
{% endspaceless %}
{% endblock form_row %}
Run Code Online (Sandbox Code Playgroud)
问题是它不尊重复选框。它像普通输入字段一样呈现复选框。知道如何根据上述模板为复选框设置模板吗?
var persons = [Dictionary<String, String>()]
println(persons.count)
Run Code Online (Sandbox Code Playgroud)
打印1.我看到数组在初始化时有一个空字典,但有没有办法避免它并且有0个元素而不是1?后来我需要能够做到:
persons.append(["firstName": "Foo", "lastName": "Bar"])
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我实现了这里所描述的双向服务通信https://angular.io/docs/ts/latest/cookbook/component-communication.html#!#bidirectional-service
import { Injectable } from '@angular/core';
import { Http, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { Subject } from 'rxjs/Subject';
@Injectable()
export class UserService {
private authenticatedSource = new Subject<boolean>();
authenticated$ = this.authenticatedSource.asObservable();
//..
login(): void {
// ...
return this.http.post(this.apiUrl + '/signup', user, options)
.map(this.extractData)
.catch(this.handleError);
}
}
Run Code Online (Sandbox Code Playgroud)
extractData我调用的内部函数
this.authenticatedSource.next(true);
Run Code Online (Sandbox Code Playgroud)
但它抛出一个错误:
Cannot read property 'next' of undefined
Run Code Online (Sandbox Code Playgroud)
当我this.authenticatedSource.next(true)在 extractData 外部调用时,比如在登录函数内部,它工作正常。这是为什么?
Angularjs特定代码:
var deferred = $q.defer(),
nextTransClass, prevTransClass;
Run Code Online (Sandbox Code Playgroud)
这是什么意思?我从未见过这样的变量赋值.
javascript ×2
jquery ×2
symfony ×2
android ×1
angular ×1
angularjs ×1
ios8 ×1
nine-patch ×1
php ×1
regex ×1
swift ×1
swift-array ×1
symfony-2.1 ×1
three20 ×1
xcode6.1 ×1