嗨,我的页面上有几个div,它们有背景图像,我想扩展以覆盖整个div,而div又可以扩展以填充视口的宽度.
显然,background-size: cover在iOS设备上出现意外行为.我已经看到了一些如何修复它的例子,但我不能让它们在我的情况下工作.理想情况下,我不想<img>在HTML中添加额外的标签,但如果这是唯一的方法,那么我会.
这是我的代码:
.section {
margin: 0 auto;
position: relative;
padding: 0 0 320px 0;
width: 100%;
}
#section1 {
background: url(...) 50% 0 no-repeat fixed;
background-size: cover;
}
#section2 {
background: url(...) 50% 0 no-repeat fixed;
background-size: cover;
}
#section3 {
background: url(...) 50% 0 no-repeat fixed;
background-size: cover;
}Run Code Online (Sandbox Code Playgroud)
<body>
<div id="section1" class="section">
...
</div>
<div id="section2" class="section">
...
</div>
<div id="section3" class="section">
...
</div>
</body>Run Code Online (Sandbox Code Playgroud)
问题是,如何考虑浏览器的可变宽度和div中内容的可变高度,如何让背景图像完全覆盖div部分?
可以从导航堆栈中弹出一个视图,然后再将其直接推到它上面吗?
我正在尝试为这一部分实现一个平面层次结构,并希望有一个分段控制器,但我不能让分段控制器看起来像我想要的任何东西,因此我为什么要尝试使用导航控制器.
单击按钮时,我执行了以下代码:
[[self navigationController] popViewControllerAnimated:YES];
MapsViewController *aViewController = [[MapsViewController alloc]
initWithNibName:@"MapsViewController" bundle:nil];
[self.navigationController pushViewController:aViewController animated:NO];
[aViewController release];
Run Code Online (Sandbox Code Playgroud)
它突然出现,但没有任何推动的迹象!任何帮助,将不胜感激.
uinavigationcontroller popviewcontroller pushviewcontroller ios
我正在编写一个RESTful API.我使用不同的动词上传图片时遇到问题.
考虑:
我有一个对象可以通过post/put/delete/get请求创建/修改/删除/查看到URL.当有文件要上传时,请求是多部分形式,或者当只有文本要处理时,请求是application/xml.
要处理与对象关联的图像上传,我正在执行以下操作:
if(isset($_FILES['userfile'])) {
$data = $this->image_model->upload_image();
if($data['error']){
$this->response(array('error' => $error['error']));
}
$xml_data = (array)simplexml_load_string( urldecode($_POST['xml']) );
$object = (array)$xml_data['object'];
} else {
$object = $this->body('object');
}
Run Code Online (Sandbox Code Playgroud)
这里的主要问题是当尝试处理put请求时,显然$ _POST不包含put数据(据我所知!).
作为参考,我正在构建请求:
curl -F userfile=@./image.png -F xml="<xml><object>stuff to edit</object></xml>"
http://example.com/object -X PUT
Run Code Online (Sandbox Code Playgroud)
有没有人有任何想法如何xml在我的PUT请求中访问变量?
我正在使用其网站上提供的SDK将Dropbox添加到我的应用中.一旦[[DBSession sharedSession] linkFromController:self];与帐户链接,有没有办法调用某种方法?
基本上我想[self.tableView reloadData]在应用程序尝试登录Dropbox时调用.它甚至不需要区分成功或不成功的登录.
我正在尝试使用日期并在将来创建日期,但夏令时不断妨碍我的时间.
这是我的代码,以移动到下个月的第一天的午夜约会:
+ (NSDate *)firstDayOfNextMonthForDate:(NSDate*)date
{
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
calendar.timeZone = [NSTimeZone systemTimeZone];
calendar.locale = [NSLocale currentLocale];
NSDate *currentDate = [NSDate dateByAddingMonths:1 toDate:date];
NSDateComponents *components = [calendar components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit
fromDate:currentDate];
[components setDay:1];
[components setHour:0];
[components setMinute:0];
[components setSecond:0];
return [calendar dateFromComponents:components];
}
+ (NSDate *) dateByAddingMonths: (NSInteger) monthsToAdd toDate:(NSDate*)date
{
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
calendar.timeZone = [NSTimeZone systemTimeZone];
calendar.locale = [NSLocale currentLocale];
NSDateComponents * months = [[NSDateComponents alloc] init];
[months setMonth: monthsToAdd]; …Run Code Online (Sandbox Code Playgroud) 我在其中一个选项卡中有一个带有导航控制器的标签栏.目前,导航控制器的根视图没有显示导航栏,并且可以很好地动画到子视图中
- (void)viewDidLoad {
...
[self.navigationController setNavigationBarHidden:YES animated:NO];
...
}
Run Code Online (Sandbox Code Playgroud)
和
- (void)viewWillAppear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
- (void)viewWillDisappear:(BOOL)animated {
[self.navigationController setNavigationBarHidden:NO animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
但是当然更改选项卡会启动该viewWillAppear功能,因此当我返回到根视图时,导航栏会滑落,而不是仅仅不在那里.
有没有办法可以隐藏根视图上的导航栏而不动画它除了从导航堆栈上的子视图出现时?
使用Go,我正在使用RTMP流,将其转码为FLAC(使用ffmpeg)并尝试流式传输到Google的Speech API以转录音频.但是,我EOF在发送数据时不断收到错误.我在文档中找不到有关此错误的任何信息,因此我不确定是什么导致它.
我将收到的数据分块为3s片段(长度不相关,只要它小于流识别请求的最大长度).
这是我的代码的核心:
func main() {
done := make(chan os.Signal)
received := make(chan []byte)
go receive(received)
go transcribe(received)
signal.Notify(done, os.Interrupt, syscall.SIGTERM)
select {
case <-done:
os.Exit(0)
}
}
func receive(received chan<- []byte) {
var b bytes.Buffer
stdout := bufio.NewWriter(&b)
cmd := exec.Command("ffmpeg", "-i", "rtmp://127.0.0.1:1935/live/key", "-f", "flac", "-ar", "16000", "-")
cmd.Stdout = stdout
if err := cmd.Start(); err != nil {
log.Fatal(err)
}
duration, _ := time.ParseDuration("3s")
ticker := time.NewTicker(duration)
for {
select {
case <-ticker.C:
stdout.Flush()
log.Printf("Received …Run Code Online (Sandbox Code Playgroud) 我正在从用户提交的 HTML/CSS 生成 PDF。客户要求 PDF 具有背景图像以添加一些品牌。PDF 库是 wkhtmltopdf11RC1。
我可以使用 PDF 转换库在背景中打印图像,但真正的问题是身体的高度不能保证是纸张高度的倍数,所以最后一页通常会被剪掉,背景图像没有显示。
PDF 库确实有 javascript 支持,但element.offsetHeight似乎不准确,因此我无法检查填充正文的大小以制作完整页面。
有没有人有类似的经历或有没有人有一个好主意?
我的 VCS 中有一个托管包。我跑:
$ pip install -vvv git+https://myvcs.com/myprotos
Run Code Online (Sandbox Code Playgroud)
这是日志。您会注意到它在安装过程中运行一个自定义脚本,该脚本实际上在项目中构建源文件。有关它正在做什么的详细信息,请参阅此问题。
Collecting git+https://myvcs.com/myprotos
Cloning https://myvcs.com/myprotos to /private/var/folders/3t/4qwkfyr903d0b7db7by2kj6r0000gn/T/pip-cFzP3I-build
Running command git clone -q https://myvcs.com/myprotos /private/var/folders/3t/4qwkfyr903d0b7db7by2kj6r0000gn/T/pip-cFzP3I-build
Running setup.py (path:/private/var/folders/3t/4qwkfyr903d0b7db7by2kj6r0000gn/T/pip-cFzP3I-build/setup.py) egg_info for package from git+https://myvcs.com/myprotos
Running command python setup.py egg_info
running egg_info
creating pip-egg-info/myprotos.egg-info
writing pip-egg-info/myprotos.egg-info/PKG-INFO
writing top-level names to pip-egg-info/myprotos.egg-info/top_level.txt
writing dependency_links to pip-egg-info/myprotos.egg-info/dependency_links.txt
writing manifest file 'pip-egg-info/myprotos.egg-info/SOURCES.txt'
reading manifest file 'pip-egg-info/myprotos.egg-info/SOURCES.txt'
writing manifest file 'pip-egg-info/myprotos.egg-info/SOURCES.txt'
Source in /private/var/folders/3t/4qwkfyr903d0b7db7by2kj6r0000gn/T/pip-cFzP3I-build has version 0.0.1, which satisfies requirement myprotos==0.0.1 from git+https://myvcs.com/myprotos
Installing collected packages: myprotos …Run Code Online (Sandbox Code Playgroud) 我有一些协议缓冲区定义需要作为pip install过程的一部分构建到 Python 源代码中。我已经对setuptools.command.install命令进行了子类化,setup.py但我认为它会在安装包后尝试运行 Makefile,因此无法识别源。
我找不到有关 pip 安装期间发生的情况的信息。任何人都可以发光吗?
设置.py:
import subprocess
import sys
from setuptools import setup
from setuptools.command.install import install
class Install(install):
"""Customized setuptools install command - builds protos on install."""
def run(self):
protoc_command = ["make", "python"]
if subprocess.call(protoc_command) != 0:
sys.exit(-1)
install.run(self)
setup(
name='myprotos',
version='0.0.1',
description='Protocol Buffers.',
install_requires=[],
cmdclass={
'install': Install,
}
)
Run Code Online (Sandbox Code Playgroud)
的输出$ pip install -vvv .:
Processing /path/to/myprotos
Running setup.py (path:/private/var/folders/3t/4qwkfyr903d0b7db7by2kj6r0000gn/T/pip-jpgCby-build/setup.py) egg_info for package from file:///path/to/myprotos
Running command …Run Code Online (Sandbox Code Playgroud) ios ×4
css ×2
pip ×2
python ×2
cocoa-touch ×1
codeigniter ×1
curl ×1
delegates ×1
dropbox ×1
ffmpeg ×1
go ×1
html ×1
http ×1
javascript ×1
makefile ×1
nscalendar ×1
nsdate ×1
nstimezone ×1
php ×1
rest ×1
setuptools ×1
wkhtmltopdf ×1