Post not yet marked as solved
For printing from worker thread to a UIPrinter(whose url i have saved ) i am doing this and able to print :
func PrintPdfDocument (pDocument:Data)
{
// Create a print interaction controller
let printController = UIPrintInteractionController.shared
// Set the printing options
let printInfo = UIPrintInfo(dictionary:nil)
printInfo.jobName = "Print Job "
printController.printInfo = printInfo
printController.showsPageRange = true
// Set the PDF document to be printed
printController.printingItems = pDocument
printController.print(to: defaulttprinter, completionHandler: { (controller, completed, error) in
if completed {
print("Printing successful!")
} else {
if let error = error {
print("Printing failed with error: \(error.localizedDescription)")
} else {
print("Printing was canceled.")
}
}
})
}
When i call PrintPdfDocument (pDocument:Data) function , more than once with diffrent data shown below :
DispatchQueue.global().async {
PrintPdfDocument (pDocument:data1)
}
DispatchQueue.global().async {
PrintPdfDocument (pDocument:data2)
}
DispatchQueue.global().async {
PrintPdfDocument (pDocument:data3)
}
Printer is printing only one document(data1) .
For other call is not executing printController.print (to....) function inside PrintPdfDocument.
Post not yet marked as solved
I have a tvOS project contains an App target and 3 static libraries:
EntryPoint – Static library that contains main , AppDelegate and SceneDelegate
Experience – Static library containing my UI elements
AppTarget – executable built using above two libraries
I have a class "SelectionTable" which subclasses UITableView in Experience target :
import UIKit
class SelectionTable : UITableView
{
private var vDataSrc:[String]!
func SetDataSrc (_ pDataSrc:[String])
{
self.vDataSrc = pDataSrc
}
func UpdateDataSrc (_ pStringList:[String])
{
self.vDataSrc += pStringList
}
func GetDataSrc () -> [String]
{
return self.vDataSrc
}
}
I am not using this class anywhere and still i am getting these errors when i build my AppTarget:
Cannot find interface declaration for 'UITableView', superclass of 'SelectionTable'
Expected a type
These above error are coming in generated header file "Experience-Swift.h". This file is auto-generated by compiler. I am not using @objc anywhere in the code, But still the Target-Swift.h file has the below lines:
SWIFT_CLASS("_TtC10Experience22SelectionTable")
@interface SelectionTable : UITableView
- (nonnull instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style OBJC_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)coder OBJC_DESIGNATED_INITIALIZER;
@end
When i am marking above class as Private , this error goes away .
And also , if i am defining SelectionTable class in EntryPoint library , this error does not occur .
I am using similar model for an iOS project also and there i am not facing this issue.
I am using :-
Swift version : Swift 5.9.2
XCode version : 15.2
I want to use CUPS in iOS for printing and it is mentioned at many places that we can use cups for printing in ios .But when i import library cups/cups.h ,xcode is giving error "cups/cups.h not found".
code i am using in a objective c file :
import <cups/cups.h>
cups_dest_t *dest;
int num_options;
cups_option_t *options;
int job_id;
/* Print a single file */
job_id = cupsPrintFile(dest->name, "/usr/share/cups/data/testprint.ps",
"Test Print", num_options, options);
Do i need to intall some driver or any library to make it work ? or is it the case that CUPS is not available for iOS?
Post not yet marked as solved
when i am adding new view to replace viewcontroller's view like this :
let viewcontroller: UIViewController!
let rootview:UIView!
viewcontroller = UIViewController ()
rootview = UIView (frame:viewcontroller.view.bounds)
viewcontroller.view = rootview
// Adding a button
let button = UIButton(type: .system)
button.setTitle("Tap Me", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 18)
button.addTarget(self, action: #selector(buttonTapped), for:.allEvents)
viewcontroller.view.addSubview(button)
For ios(iPhone/ipad) , i am able to get button click event .
But in case of tvOS , i am not getting button click event.
But in case of tvOS if use the default view of viewcontroller like this , i am getting button click events and things works fine:
let viewcontroller: UIViewController!
viewcontroller = UIViewController ()
// Adding a button
let button = UIButton(type: .system)
button.setTitle("Tap Me", for: .normal)
button.titleLabel?.font = UIFont.systemFont(ofSize: 18)
button.addTarget(self, action: #selector(buttonTapped), for:.allEvents)
viewcontroller.view.addSubview(button)
Is this some bug for tvOS or for tvOS this suppose to happen this way ?
Post not yet marked as solved
I want to use uitableview in tvos to show list of string data but compiler is throughing following errors in generated header:
"No type or protocol named 'UITableViewDataSource'"
And "Attempting to use the forward class 'UITableView' as superclass of 'TWOSSelectionTableTVOS'"
Even though this code is working is ios .
My code structure is as follow :
SelectionTable.swift:
import UIKit
class TWOSSelectionTableTVOS : UITableView
{
private var vDataSrc:[String]!
func SetDataSrc (_ pDataSrc:[String])
{
self.vDataSrc = pDataSrc
}
func UpdateDataSrc (_ pStringList:[String])
{
self.vDataSrc += pStringList
}
func GetDataSrc () -> [String]
{
return self.vDataSrc
}
}
PaintUI.swift :
import UIKit
@objc
class PaintUI: NSObject,UITableViewDelegate, UITableViewDataSource {
static let uShared = PaintUI ()
@objc
static func updateUIMessage() {
DispatchQueue.main.async {
ExecuteInlineSelectionTable ()
}
}
func tableView (_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 5
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell (withIdentifier: "cell", for: indexPath)
cell.textLabel?.text = "hello"
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let viewcontroller: TWIOSViewController!
viewcontroller = StaticContext.sViewController
}
public static func ExecuteInlineSelectionTable ()
{
let selectiontable:TWOSSelectionTableTVOS!
selectiontable = TWOSSelectionTableTVOS ()
selectiontable.register (UITableViewCell.self, forCellReuseIdentifier: "cell")
selectiontable.dataSource = uShared
selectiontable.delegate = uShared
selectiontable.isScrollEnabled = true
// TODO : will add selection table in view heriearchy but currently getting
// compilation error
}
}
And finally calling PaintUI.updateUIMessage () , it is throughing above errors for tvOS only but in case of ios code is working fine.
Post not yet marked as solved
when i select target as "All builds" i am getting list of simulators .
but when i select target as "SCPNative" i am not getting list of simulators.
Deployment target is 7.0 whereas sdk is 10.2.
Is there any way to get list of system shortcuts set by user or reserved by os programatically?
Post not yet marked as solved
In my application i want to override the default behavior of undo and redo .In ipad , when user presses cmd+c/v , want to trigger some other action instead of default copy/paste . And in case of ipad , i want to trigger diffrent action for three finger touch gesture . Is it possible to do that?
Post not yet marked as solved
I want to attach a three pinch zoom to my UITableView .
When user uses three pinch zoom i want to show more details in uitableview where as in two pinch zoom i want normal zoom behavior . But when i am using UIPinchGesture it is only giving numberOfTouches as 2 even when i use three fingers .