我试图将标题添加UISegmentedControl到底部UINavigationBar.但我不能添加它,我不能添加UISegmentedControl在tableView.headerView,因为我需要在搜索栏tableView.headerView,所以只有一个解决方案,我需要添加UISegmentedControl到的底部UINavigationBar.任何人都有另一种想法,我可以解决这种情况?
这是我尝试过的代码(使用Swift):
class searchingViewController: UITableViewController{
override func viewDidLoad() {
var items: [AnyObject] = ["Searching Method A", "Searching Method B"]
var searchSC:UISegmentedControl!
searchSC.frame = CGRectMake(0, 0, frame.width - 20, 30)
searchSC.selectedSegmentIndex = 1
searchSC.backgroundColor = UIColor(white: 1, alpha: 1)
searchSC.layer.cornerRadius = 5.0
navigateUIToolBar = UIToolbar(frame: CGRectMake(frame.minX + 10, ios7_8Info.getStatusBarHeight()+self.navigationController!.navigationBar.frame.height+frame.minY+(21/2),
frame.width - 20, 30))
navigateUIToolBar.addSubview(searchSC)
self.navigationController?.navigationBar.addSubview(navigateUIToolBar)
}
}
Run Code Online (Sandbox Code Playgroud) 我试图用来PopModalAsync删除模态页面.但是,Navigation.ModalStack.Count为0.如果我使用PopModalAsync,它将抛出异常:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
我在用Xamarin.Forms.以下是一些示例代码:
App.cs(Potable)
public class App : Application
{
public App()
{
// The root page of your application
MainPage = new View.LoginPage();
}
}
Run Code Online (Sandbox Code Playgroud)
LoginPage.xaml.cs(Potable)
public partial class LoginPage : ContentPage
{
public INavigation _Navigate;
public LoginPage()
{
InitializeComponent();
_Navigate = Navigation;
}
async void LoginBtnClicked(object sender, EventArgs args)
{
await …Run Code Online (Sandbox Code Playgroud) 这些 PDF 具有相同的代码和相同的格式,区别在于文本语言。它可以渲染第一个 PDF,但无法渲染第二个 PDF。我使用以下代码对 dompdf 进行了测试,导致错误 500。另外,我使用Codeigniter框架。这是 dompdf 的错误还是我的错误?
$lang_array = array("chi","eng");
$i = 0;
foreach($lang_array as $lang)
{
$html = "<!DOCTYPE html><html><body>M</body></html>";
$this->dompdf->load_html($html);
$this->dompdf->set_paper("A4", 'portrait');
$this->dompdf->render();
$output = $this->dompdf->output();
file_put_contents($i.".pdf", $output);
$i++;
}
Run Code Online (Sandbox Code Playgroud) 我尝试当设备在swift中旋转时,ios 7将获得错误的状态栏高度.我测试了IPad Air(ios 7.0)和IPhone 6(ios 8.2).有没有任何解决方案可以获得正确的状态栏高度?
问题编码(它得到self.view.bounds.size.width):
let status_height = UIApplication.sharedApplication().statusBarFrame.size.height
Run Code Online (Sandbox Code Playgroud)