Titanium Hyperloop casting ListView to UIScrollView to use flashScrollIndicators - appcelerator-hyperloop

I want to flash the scrollbars of a ListView in Axway / Appcelerator Titanium. So I cast a Titanium ListView to a iOS UIScrollView and then try to call the flashScrollIndicators method on it, but I get an exception. Does anyone now how to accomplish this? See my code below:
-- View
<Alloy>
<Window onOpen="onWindowOpen">
<ListView id="listView">
etc...
-- Controller
// After displaying the ListView I call:
var UIScrollView = require('UIKit/UIScrollView');
var listView = UIScrollView.cast($.listView);
listView.flashScrollIndicators();

The $.listView object is natively a subclass of UIView, not a UIScrollView. It contains a UITableView as a child view. You could access the tableview like this:
var UIView = require('UIKit/UIView');
var listView = UIView.cast($.listView);//you cast it to be able to access it's native properties
listView.tableView.flashScrollIndicators();
Haven't tested it but I guess it should work.
When in doubt about the type of a Titanium UI element, just go and check the source code by opening the project compiled in the build/iphone directory. Open it with XCode and search for the header file.

Related

Navigation view is hiding while pushing from SwiftUI views to Storyboard project in iOS13

I have added SwiftUI views in my existing swift project.
I have the following flow in the project
FirstViewController --NavigationPush -> SwiftUIView1 -NavigationLink->
SwiftUIView2 - NavigationLink-> SwiftUIView3 - NavigationLink
(UIViewRepresentable) -> SecondViewController.
till SwiftUIView3 everything works as expected. while pushing from SwiftUIView3 -> SecondViewController, even though I'm setting the navigation property isHidden = false,
the navigationBar appears in the controller for a fraction of sec and disappears. I have tried to unhide navigation in all the controller life cycle methods. But nothing happens. Please let me know your suggestion to resolve this.
FYI, below code, I used SwiftUI to hide the navigation bar.
Code Block
.navigationBarTitle("") // This should be empty.
.navigationBarBackButtonHidden(true)
.navigationBarHidden(true)

How to setUp UiTableViewController below the battery bar

newBie here. I have added an UItableViewController into storyBoard. I use this as a setting page.
HomeVC ----> Setting VC
In code : I use the below code to bring the tableView below the battery Bar:
self.tableView.contentInset = UIEdgeInsets(top: 20,left: 0,bottom: 0,right: 0)
Problem:
How to move the TableView down below the battery bar so that I can add a button above the table in StoryBoard
Please help.
For this you should use a normal view controller and drag a table on the view controller this way you can make the table size whatever you like. This will also allow you to place buttons wherever you like.
Don't forget to assign the TableViewDataSource and TableViewDelegate to your view controller.
Good luck!
After doing some search on UiTableViewController, to use it as setting page I have to set static cell to it. This UiTableViewController will occupy the entire view.
To set the tableView below the battery icon,
use:self.tableView.contentInset = UIEdgeInsets(top: 20,left: 0,bottom: 0,right: 0)
However, No need to do so. In the first TableViewSection, you can create a few tableView cell, just leave the first cell blank which acts as a margin below the battery bar.

WebView dismissed if choose file and select photo Library

I'm working on a project where I'm using webView and on site in webView have form where i can add file,
after need select what use, i select Photo library,
after controller will dismissed.
In Controller i use
webView.loadRequest(NSURLRequest(URL: NSURL(string: ln)!))
Set Delegate to webview.
webView.delegate = self
Then after call delegate method of webview.
func webViewDidFinishLoad(_ webView: UIWebView)
Enter your code above method of choose file and select photo Library.

IBInspectable attributes not appearing in Xcode 8 "user defined runtime attributes" area?

I'm running XCode 8.1 and can not get my IBInspectable attributes appearing in Xcode. Any known issues with XCode 8.1 (swift 3) in this area? Or any issues with what I'm trying to do here?
Steps:
Create a simple IOS app
Created the following "customControl" class
In the app storyboard, drag a UIView onto the storyboard, and then change the class type of the "customControl"
I note XCode going through the "refresh views" stage, however no items get added to the "user defined runtime attributes" area?
Code:
import UIKit
#IBDesignable
class customControl : UIView {
#IBInspectable
var customAttribute: UIColor = UIColor.blue
}

ScrollView in pageView

I have pageView where in the bottom of each page there is a scrollView.
I want that the pageView doesn't turn when the scrollView is scrolling.
My problem is:
when I scroll (in the scrollView) the pages turn with him!
This may not a good practice but it can solve your problem: in Xcode go to your project/ cocos2d_libs.xcodeproject/ extensions/ GUI/ CCScrollView
In CCScrollView.h add:
void mySetSwallowTouch(bool enabled);
In CCScrollView.cpp add:
void ScrollView::mySetSwallowTouch(bool enabled) {
_touchListener->setSwallowTouches(enabled);}
Now call mySetSwallowTouch(true) at your scrollview
scrollview->mySetSwallowTouch(true);
You can also use this with your table view inside a pageView
Since cocos2d-x v3.3 there is already a method void mySetSwallowTouch(bool enabled) available for ListView.
You can simply use it:
ListView* listView = ListView::create();
listView->setSwallowTouches(true);
BTW, I believe swallow touches is currently set to true for ListView by default.