所以我将需要在我的应用程序中使用路径数据,有没有办法将您已有的图像转换为路径数据?
或唯一的方法是使用Photoshop等自己实际计算所有像素.?
我正在我的应用程序中打开一个NestedScrollView,到目前为止它从屏幕底部打开.如何从顶部打开它?
我尝试删除以下行:
app:layout_behavior="android.support.design.widget.BottomSheetBehavior"
Run Code Online (Sandbox Code Playgroud)
但该应用程序崩溃时出现以下错误:
The view is not associated with BottomSheetBehavior
Run Code Online (Sandbox Code Playgroud)
有没有办法从屏幕顶部打开底部工作表?
这是我的活动:
ViewPager mainViewPager;
private BottomSheetBehavior mBottomSheetBehavior;
int switcher = 1;
View menuPopupView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.workorder_selection_layout_with_fragment);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
...
....
...
filterButton = (Button)
findViewById(R.id.filterButtonMainWorkorderSelection);
filterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (switcher == 1) {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
switcher = 2;
} else {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
switcher = 1;
}
}
});
///////////////////////////////////////////
//////////////Buttom Sheet/////////////////
///////////////////////////////////////////
View bottomSheet = …Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中有一个Image carousel我使用UIScrollView来显示里面的图像.一切正常,只是我想知道如何阻止UIScrollView中的移动
我试图阻止垂直滚动:
scrollView.showsVerticalScrollIndicator = false
scrollView.contentSize = CGSize(width: scrollView.contentSize.width, height: 0) //disable vertical
Run Code Online (Sandbox Code Playgroud)
一切都很好,它真的阻止了垂直滚动
问题是,我还有一个计时器,它UIScrollView通过以下方式以编程方式移动:
var frame: CGRect = scrollView.frame
frame.origin.x = frame.size.width * CGFloat(pageToMove)
frame.origin.y = -35
scrollView.scrollRectToVisible(frame, animated: true)
Run Code Online (Sandbox Code Playgroud)
并且一旦我阻止垂直滚动,这个功能scrollReactToVisible就不会做任何事情.我没有得到任何错误.
有没有一种方法可以垂直阻止滚动(并允许像往常一样左右滚动),并以编程方式移动滚动视图?
我正在附加我的全视图控制器:
class CaruselleScreenViewController: UIViewController, CaruselleScreenViewProtocol, UIScrollViewDelegate {
var myPresenter: CaruselleScreenPresenterProtocol?
@IBOutlet weak var pageControl: UIPageControl!
@IBOutlet weak var scrollView: UIScrollView!
var slides:[CaruselleTipsCard] = [];
var timer:Timer?
var currentPageMultiplayer = 0
override func viewDidLoad() {
super.viewDidLoad()
myPresenter = CaruselleScreenPresenter(controller: self)
//initlizes view
pageControl.numberOfPages …Run Code Online (Sandbox Code Playgroud) 我曾尝试使用一些库,但似乎找不到任何答案。我有一个 React 站点,我正在使用表单上传文件。我正在寻找一种解析XML文件的方法,并找到它的孩子,但我似乎找不到这样做的方法。
我的表格:
<form onSubmit={this.handleSubmit}>
<label>
Upload file:
<input type="file" ref={input => {this.App = input}} />
</label>
<br />
<button type="submit">Submit</button>
</form>
Run Code Online (Sandbox Code Playgroud)
我的听众:
我的活动:
handleSubmit(event) {
//here the file will be opened
//submit pressed
var rawFile = new XMLHttpRequest();
var allText;
rawFile.open("GET", this.App.files[0], false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
allText = rawFile.responseText;
// alert(allText);
}
}
}
rawFile.send(null);
alert(allText);
}
Run Code Online (Sandbox Code Playgroud)
我的 xml 文件:
<?xml version="1.0" …Run Code Online (Sandbox Code Playgroud) 我有一个触发器来向用户显示通知:
let content = UNMutableNotificationContent()
content.title = "Title"
content.body = "Body"
content.sound = UNNotificationSound.default
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 20, repeats: false)
let request = UNNotificationRequest(identifier: "TestIdentifier", content: content, trigger: trigger)
UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)
Run Code Online (Sandbox Code Playgroud)
一旦设置了该触发器,我有没有办法取消它?
如何在timeInterval用完之前取消通知并调用通知?
我有一个使用角形材料设计的登录卡,每当我在页面上运行该登录卡时,内容都会粘贴在页面左侧。
我尝试使用flex和使用,layout-align="center center"但仍无法将卡片带到页面中央
我究竟做错了什么 ?
这是我的html:
<mat-card class="example-card" layout="row" layout-align="center center">
<mat-card-header>
<div class="login-box-header" layout="row" layout-align="center center">
<img src="https://image.ibb.co/hDqa3p/codershood.png">
</div>
</mat-card-header>
<mat-card-content>
<form class="example-form">
<table class="example-full-width" cellspacing="0">
<tr>
<td>
<mat-form-field class="example-full-width">
<input matInput placeholder="Username" [(ngModel)]="username" name="username" required>
</mat-form-field>
</td>
</tr>
<tr>
<td><mat-form-field class="example-full-width">
<input matInput placeholder="Password" [(ngModel)]="password"type="password" name="password" required>
</mat-form-field></td>
</tr></table>
</form>
<mat-spinner [style.display]="showSpinner ? 'block' : 'none'"></mat-spinner>
</mat-card-content>
<mat-card-actions>
<button mat-raised-button (click)="login()" color="primary">Login</button>
</mat-card-actions>
</mat-card>
Run Code Online (Sandbox Code Playgroud)
这里的内容仍然没有居中:
我有一个包含两个碎片的活动,我想在其中一个碎片上运行ZXING扫描仪,
目前我在这样的另一个活动上做这个>
new IntentIntegrator(this).initiateScan(); // opens up Scan intent > ZXING
Run Code Online (Sandbox Code Playgroud)
我该怎么做但是打开一个片段的扫描?
此外,我在这样的接收器上获得了ZXING结果
//results when activity enters a callback sent out to another activity
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
Run Code Online (Sandbox Code Playgroud)
我将如何在我的碎片上得到它们,我将要运行Zxing?
日Thnx
我的navigation bar应用程序中有后退按钮
我想将默认情况下的后台文本覆盖为我的项目(资源文件夹)中的图标
我如何引用该后退按钮以及如何将其更改为图标?
这就是我想将其更改为:
我有一个类使用协议调用另一个类中的函数:
func calculateTableSize () {
// doing some stuff
// the call to the other function using the protocol
summaryPresenter?.onCalculateTableSizeDone()
}
Run Code Online (Sandbox Code Playgroud)
我想使用此函数传递一个类型为enum的数据数组:
class SummaryInteractor: SummaryScreenInteractorFunctionsProtocol {
//sections
enum Section: Int, CaseIterable {
case header = 0, description, diagnoses, perscription, notes, addFaxHeadline, addFax, addEmailHeadline, addEmails, givePermissionHeadline, selecAnswer, addNewEmail,addNewFax, removableText, headlineEmpty
}
var sectionData: [Section] = [
.header
]
...
...
Run Code Online (Sandbox Code Playgroud)
问题显然是我不能在我的协议中添加这一行(这是我想要实现的):
//what will be written in the presenterFromTheInteractor
protocol SummaryScreenInteractorProtocol {
func onCalculateTableSizeDone(data: [Section])
}
Run Code Online (Sandbox Code Playgroud)
因为那时协议(以及所有其他类都不会知道这个新的Enum类型,什么是Selection.
因此,它出错了:
func calculateTableSize () { …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的应用中创建超链接,并且正在实现此解决方案:
let attributedString = NSMutableAttributedString(string: "Just click here to register")
let url = URL(string: "https://www.apple.com")!
// Set the 'click here' substring to be the link
attributedString.setAttributes([.link: url], range: NSMakeRange(5, 10))
self.headerDescription.attributedText = attributedString
self.headerDescription.isUserInteractionEnabled = true
self.headerDescription.isEditable = false
// Set how links should appear: blue and underlined
self.headerDescription.linkTextAttributes = [
NSForegroundColorAttributeName: UIColor.blue,
NSUnderlineStyleAttributeName: NSUnderlineStyle.styleSingle.rawValue,
]
Run Code Online (Sandbox Code Playgroud)
但是它会出错:
无法将类型[[NSAttributedStringKey:任何]]的值分配给类型[[String:任何]?
我究竟做错了什么?
这是我的完整代码:
//
// HeaderInfoTableViewCell.swift
// Triage App
//
// Created by Shay Vidas on 28/11/2018.
// Copyright © 2018 Shay Vidas. …Run Code Online (Sandbox Code Playgroud) 我有一个UITableview具有独特单元格的单元格,每个单元格都有自己的类,并且它们具有我想要连接到主体的动作UITableviewcontroller
我附加一个协议并在tableviewcontroller中打开它但它没有被读取
我怎么能初始化它或我做错了什么?
这是我的细胞类:
import UIKit
class AddFaxHeadlineTableViewCell: UITableViewCell {
var delegate: AddFaxHeadlineProtocol?
@IBOutlet weak var addButton: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
@IBAction func onAddFaxNumberPressed(_ sender: Any) {
delegate?.faxButtonPressed()
}
}
protocol AddFaxHeadlineProtocol{
func faxButtonPressed()
}
Run Code Online (Sandbox Code Playgroud)
在我的tableviewcontroller中我扩展了协议:
class SummaryMainTableViewController: UITableViewController, AddFaxHeadlineProtocol, AddEmailHeadlineProtocol {
Run Code Online (Sandbox Code Playgroud)
但函数本身永远不会被读取:
func faxButtonPressed() {
var indexToInsert = 0
for …Run Code Online (Sandbox Code Playgroud) swift ×7
android ×3
xcode ×3
angular ×1
bottom-sheet ×1
css ×1
html ×1
ios ×1
javascript ×1
reactjs ×1
uiscrollview ×1
uitableview ×1
uitextview ×1
view ×1
zxing ×1