Changed contextual menus
This commit is contained in:
@@ -268,8 +268,8 @@
|
|||||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TTj-dw-Xk5" customClass="UIViewX" customModule="Zockerhoehle" customModuleProvider="target">
|
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TTj-dw-Xk5" customClass="UIViewX" customModule="Zockerhoehle" customModuleProvider="target">
|
||||||
<rect key="frame" x="20" y="94" width="374" height="165"/>
|
<rect key="frame" x="20" y="94" width="374" height="165"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="headTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tE2-hr-JfW" customClass="UIButtonX" customModule="Zockerhoehle" customModuleProvider="target">
|
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="headTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tE2-hr-JfW" customClass="UIButtonX" customModule="Zockerhoehle" customModuleProvider="target">
|
||||||
<rect key="frame" x="284" y="125" width="80" height="30"/>
|
<rect key="frame" x="284" y="128" width="80" height="30"/>
|
||||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="80" id="etr-ZW-p0W"/>
|
<constraint firstAttribute="width" constant="80" id="etr-ZW-p0W"/>
|
||||||
@@ -291,8 +291,8 @@
|
|||||||
<action selector="nameChanged:" destination="mMA-rS-Z54" eventType="editingChanged" id="ITW-2N-h1I"/>
|
<action selector="nameChanged:" destination="mMA-rS-Z54" eventType="editingChanged" id="ITW-2N-h1I"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Name" textAlignment="justified" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="z4u-nB-SLu">
|
<textField opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Name" textAlignment="justified" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="z4u-nB-SLu">
|
||||||
<rect key="frame" x="10" y="85" width="354" height="30"/>
|
<rect key="frame" x="10" y="88" width="354" height="30"/>
|
||||||
<nil key="textColor"/>
|
<nil key="textColor"/>
|
||||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||||
<textInputTraits key="textInputTraits"/>
|
<textInputTraits key="textInputTraits"/>
|
||||||
@@ -334,8 +334,8 @@
|
|||||||
<constraint firstAttribute="height" constant="65" id="fcH-H1-oiw"/>
|
<constraint firstAttribute="height" constant="65" id="fcH-H1-oiw"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
</imageView>
|
</imageView>
|
||||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qie-gc-pdo" customClass="UIButtonX" customModule="Zockerhoehle" customModuleProvider="target">
|
<button opaque="NO" contentMode="scaleToFill" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="qie-gc-pdo" customClass="UIButtonX" customModule="Zockerhoehle" customModuleProvider="target">
|
||||||
<rect key="frame" x="10" y="125" width="80" height="30"/>
|
<rect key="frame" x="10" y="128" width="80" height="30"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="width" constant="80" id="gfE-Tz-NZg"/>
|
<constraint firstAttribute="width" constant="80" id="gfE-Tz-NZg"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
@@ -355,14 +355,10 @@
|
|||||||
<action selector="cancel:" destination="mMA-rS-Z54" eventType="primaryActionTriggered" id="8bf-ml-hbC"/>
|
<action selector="cancel:" destination="mMA-rS-Z54" eventType="primaryActionTriggered" id="8bf-ml-hbC"/>
|
||||||
</connections>
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<imageView userInteractionEnabled="NO" alpha="0.59999999999999998" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="star" translatesAutoresizingMaskIntoConstraints="NO" id="psR-V9-0x7">
|
<switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6O6-V2-W3p">
|
||||||
<rect key="frame" x="200" y="5" width="40" height="33"/>
|
<rect key="frame" x="234" y="8" width="51" height="31"/>
|
||||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||||
<constraints>
|
</switch>
|
||||||
<constraint firstAttribute="width" constant="40" id="k14-Xf-b9C"/>
|
|
||||||
<constraint firstAttribute="height" constant="33" id="kN9-mM-275"/>
|
|
||||||
</constraints>
|
|
||||||
</imageView>
|
|
||||||
</subviews>
|
</subviews>
|
||||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
<constraints>
|
<constraints>
|
||||||
@@ -374,12 +370,10 @@
|
|||||||
<constraint firstAttribute="trailing" secondItem="z4u-nB-SLu" secondAttribute="trailing" constant="10" id="FLE-C8-JvN"/>
|
<constraint firstAttribute="trailing" secondItem="z4u-nB-SLu" secondAttribute="trailing" constant="10" id="FLE-C8-JvN"/>
|
||||||
<constraint firstAttribute="height" constant="165" id="IfA-es-FPw"/>
|
<constraint firstAttribute="height" constant="165" id="IfA-es-FPw"/>
|
||||||
<constraint firstAttribute="bottom" secondItem="tE2-hr-JfW" secondAttribute="bottom" constant="10" id="Ilh-0A-Cwp"/>
|
<constraint firstAttribute="bottom" secondItem="tE2-hr-JfW" secondAttribute="bottom" constant="10" id="Ilh-0A-Cwp"/>
|
||||||
<constraint firstItem="psR-V9-0x7" firstAttribute="top" secondItem="TTj-dw-Xk5" secondAttribute="top" constant="5" id="Iqd-l7-R8Z"/>
|
|
||||||
<constraint firstItem="xaq-UB-QTY" firstAttribute="leading" secondItem="7Re-uZ-JmH" secondAttribute="trailing" constant="10" id="JW1-Hn-s7v"/>
|
<constraint firstItem="xaq-UB-QTY" firstAttribute="leading" secondItem="7Re-uZ-JmH" secondAttribute="trailing" constant="10" id="JW1-Hn-s7v"/>
|
||||||
<constraint firstItem="qie-gc-pdo" firstAttribute="leading" secondItem="TTj-dw-Xk5" secondAttribute="leading" constant="10" id="Job-QR-d6g"/>
|
<constraint firstItem="qie-gc-pdo" firstAttribute="leading" secondItem="TTj-dw-Xk5" secondAttribute="leading" constant="10" id="Job-QR-d6g"/>
|
||||||
<constraint firstItem="7Re-uZ-JmH" firstAttribute="leading" secondItem="TTj-dw-Xk5" secondAttribute="leading" constant="10" id="LNR-Tc-BlQ"/>
|
<constraint firstItem="7Re-uZ-JmH" firstAttribute="leading" secondItem="TTj-dw-Xk5" secondAttribute="leading" constant="10" id="LNR-Tc-BlQ"/>
|
||||||
<constraint firstItem="qie-gc-pdo" firstAttribute="top" secondItem="z4u-nB-SLu" secondAttribute="bottom" constant="10" id="XtQ-v8-W6X"/>
|
<constraint firstItem="qie-gc-pdo" firstAttribute="top" secondItem="z4u-nB-SLu" secondAttribute="bottom" constant="10" id="XtQ-v8-W6X"/>
|
||||||
<constraint firstItem="psR-V9-0x7" firstAttribute="leading" secondItem="pY1-Ze-9Au" secondAttribute="trailing" constant="5" id="Y92-MK-X04"/>
|
|
||||||
<constraint firstItem="pY1-Ze-9Au" firstAttribute="leading" secondItem="TTj-dw-Xk5" secondAttribute="leading" constant="10" id="cRN-zD-8Sq"/>
|
<constraint firstItem="pY1-Ze-9Au" firstAttribute="leading" secondItem="TTj-dw-Xk5" secondAttribute="leading" constant="10" id="cRN-zD-8Sq"/>
|
||||||
<constraint firstItem="tE2-hr-JfW" firstAttribute="top" secondItem="z4u-nB-SLu" secondAttribute="bottom" constant="10" id="dYi-b9-2o2"/>
|
<constraint firstItem="tE2-hr-JfW" firstAttribute="top" secondItem="z4u-nB-SLu" secondAttribute="bottom" constant="10" id="dYi-b9-2o2"/>
|
||||||
<constraint firstItem="xaq-UB-QTY" firstAttribute="top" secondItem="TTj-dw-Xk5" secondAttribute="top" constant="10" id="rzU-h9-bpr"/>
|
<constraint firstItem="xaq-UB-QTY" firstAttribute="top" secondItem="TTj-dw-Xk5" secondAttribute="top" constant="10" id="rzU-h9-bpr"/>
|
||||||
@@ -411,12 +405,12 @@
|
|||||||
<outlet property="category" destination="7Re-uZ-JmH" id="SLA-H4-6ql"/>
|
<outlet property="category" destination="7Re-uZ-JmH" id="SLA-H4-6ql"/>
|
||||||
<outlet property="icon" destination="xaq-UB-QTY" id="cUt-FW-MM5"/>
|
<outlet property="icon" destination="xaq-UB-QTY" id="cUt-FW-MM5"/>
|
||||||
<outlet property="name" destination="z4u-nB-SLu" id="lRV-dW-ZpI"/>
|
<outlet property="name" destination="z4u-nB-SLu" id="lRV-dW-ZpI"/>
|
||||||
<outlet property="wishlistIcon" destination="psR-V9-0x7" id="w6S-oo-0ar"/>
|
<outlet property="wishlist" destination="6O6-V2-W3p" id="5bE-aq-zxu"/>
|
||||||
</connections>
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<placeholder placeholderIdentifier="IBFirstResponder" id="DA6-P7-KUh" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
<placeholder placeholderIdentifier="IBFirstResponder" id="DA6-P7-KUh" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
<point key="canvasLocation" x="1921" y="163"/>
|
<point key="canvasLocation" x="1920.289855072464" y="162.72321428571428"/>
|
||||||
</scene>
|
</scene>
|
||||||
<!--Hosting Controller-->
|
<!--Hosting Controller-->
|
||||||
<scene sceneID="0Pa-u4-vNw">
|
<scene sceneID="0Pa-u4-vNw">
|
||||||
@@ -497,8 +491,5 @@
|
|||||||
<point key="canvasLocation" x="493" y="-1000"/>
|
<point key="canvasLocation" x="493" y="-1000"/>
|
||||||
</scene>
|
</scene>
|
||||||
</scenes>
|
</scenes>
|
||||||
<resources>
|
|
||||||
<image name="star" width="512" height="512"/>
|
|
||||||
</resources>
|
|
||||||
<color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
<color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||||
</document>
|
</document>
|
||||||
|
|||||||
@@ -15,20 +15,20 @@ class AddEntryPopUpViewController: UIViewController {
|
|||||||
|
|
||||||
@IBOutlet weak var icon: UIImageView!
|
@IBOutlet weak var icon: UIImageView!
|
||||||
@IBOutlet weak var category: UISegmentedControl!
|
@IBOutlet weak var category: UISegmentedControl!
|
||||||
@IBOutlet weak var wishlistIcon: UIImageView!
|
|
||||||
@IBOutlet weak var name: UITextField!
|
@IBOutlet weak var name: UITextField!
|
||||||
@IBOutlet weak var addButton: UIButtonX!
|
@IBOutlet weak var addButton: UIButtonX!
|
||||||
|
@IBOutlet weak var wishlist: UISwitch!
|
||||||
|
|
||||||
override func viewWillAppear(_ animated: Bool) {
|
override func viewWillAppear(_ animated: Bool) {
|
||||||
super.viewWillAppear(animated)
|
super.viewWillAppear(animated)
|
||||||
|
|
||||||
self.category.selectedSegmentIndex = 0
|
self.category.selectedSegmentIndex = 0
|
||||||
|
|
||||||
if (!self.isVideogame && !self.isWishlist) {
|
if (!self.isVideogame) {
|
||||||
self.category.selectedSegmentIndex = 1
|
self.category.selectedSegmentIndex = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
self.wishlistIcon.isHidden = !self.isWishlist
|
self.wishlist.isOn = self.isWishlist
|
||||||
|
|
||||||
self.icon.image = self.console?.logo?.image
|
self.icon.image = self.console?.logo?.image
|
||||||
|
|
||||||
@@ -50,16 +50,19 @@ class AddEntryPopUpViewController: UIViewController {
|
|||||||
|
|
||||||
if self.isVideogame {
|
if self.isVideogame {
|
||||||
let game = Game(entity: Game.entity(), insertInto: CDManager.shared.viewContext)
|
let game = Game(entity: Game.entity(), insertInto: CDManager.shared.viewContext)
|
||||||
|
print("Created New Game")
|
||||||
game.name = name
|
game.name = name
|
||||||
game.console = console
|
game.inWishlist = self.wishlist.isOn
|
||||||
|
game.console = self.console
|
||||||
|
|
||||||
print("Added Game '\(game.name)'")
|
print("Added Game '\(game.name)' onWishlist \(self.wishlist.isOn)")
|
||||||
}else{
|
}else{
|
||||||
let accessory = Accessory(entity: Accessory.entity(), insertInto: CDManager.shared.viewContext)
|
let accessory = Accessory(entity: Accessory.entity(), insertInto: CDManager.shared.viewContext)
|
||||||
accessory.name = name
|
accessory.name = name
|
||||||
accessory.console = console
|
accessory.console = console
|
||||||
|
accessory.inWishlist = wishlist.isOn
|
||||||
|
|
||||||
print("Added Accessory '\(accessory.name)'")
|
print("Added Accessory '\(accessory.name)' onWishlist \(wishlist.isOn)")
|
||||||
}
|
}
|
||||||
|
|
||||||
self.dismiss(animated: true)
|
self.dismiss(animated: true)
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class ConsoleLibraryViewController: UIViewController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addPopup.console = self.console
|
addPopup.console = self.console
|
||||||
|
addPopup.isWishlist = self.showWishlist
|
||||||
addPopup.isVideogame = self.category.selectedSegmentIndex == 0
|
addPopup.isVideogame = self.category.selectedSegmentIndex == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,38 +153,60 @@ extension ConsoleLibraryViewController: UITableViewDelegate {
|
|||||||
bought.image = #imageLiteral(resourceName: "cave")
|
bought.image = #imageLiteral(resourceName: "cave")
|
||||||
bought.backgroundColor = #colorLiteral(red: 0.4666666687, green: 0.7647058964, blue: 0.2666666806, alpha: 1)
|
bought.backgroundColor = #colorLiteral(red: 0.4666666687, green: 0.7647058964, blue: 0.2666666806, alpha: 1)
|
||||||
|
|
||||||
|
var actions : [UIContextualAction] = []
|
||||||
if (self.showWishlist) {
|
if (self.showWishlist) {
|
||||||
return UISwipeActionsConfiguration(actions: [bought])
|
actions.append(bought)
|
||||||
}
|
}
|
||||||
|
|
||||||
return UISwipeActionsConfiguration(actions: [])
|
let swipeConf = UISwipeActionsConfiguration(actions: actions)
|
||||||
|
swipeConf.performsFirstActionWithFullSwipe = false
|
||||||
|
|
||||||
|
return swipeConf
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete console item from library
|
// Delete console item from library
|
||||||
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {
|
||||||
/*let selectedItem = self.consoleItemsToDisplay()[indexPath.row]
|
|
||||||
let delete = UIContextualAction(style: .destructive, title: "Delete") { (action, view, actionDone) in
|
let delete = UIContextualAction(style: .destructive, title: "Delete") { (action, view, actionDone) in
|
||||||
|
|
||||||
|
var nso : NSManagedObject? = .none
|
||||||
|
var name : String?
|
||||||
|
if self.category.selectedSegmentIndex == 0 {
|
||||||
|
nso = self.videoGamesInLibrary[self.showWishlist]?[indexPath.row]
|
||||||
|
name = self.videoGamesInLibrary[self.showWishlist]?[indexPath.row].name
|
||||||
|
|
||||||
|
}else{
|
||||||
|
nso = self.accessoriesinLibrary[self.showWishlist]?[indexPath.row]
|
||||||
|
name = self.accessoriesinLibrary[self.showWishlist]?[indexPath.row].name
|
||||||
|
}
|
||||||
|
|
||||||
let deleteWarning = UIAlertController( title: "Aus Zockerhöhle entfernen",
|
let deleteWarning = UIAlertController( title: "Aus Zockerhöhle entfernen",
|
||||||
message: "Willst du '\("N/A")' wirklich aus der Zockerhöhle tragen?",
|
message: "Willst du '\(name ?? "N/A")' wirklich aus der Zockerhöhle tragen?",
|
||||||
preferredStyle: .alert)
|
preferredStyle: .alert)
|
||||||
|
|
||||||
deleteWarning.addAction(UIAlertAction(title: "Ja", style: .destructive, handler: { (action) in
|
deleteWarning.addAction(UIAlertAction(title: "Ja", style: .destructive, handler: { (action) in
|
||||||
actionDone(true)
|
actionDone(true)
|
||||||
|
if nso != nil {
|
||||||
//FlockeWS.deleteEntry(by: selectedItem.id);
|
CDManager.shared.viewContext.delete(nso!)
|
||||||
//GameCollection.shared.removeGameItem(from: self.currentConsole!, item: selectedItem)
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
deleteWarning.addAction(UIAlertAction(title: "Nein", style: .cancel, handler: { (action) in
|
deleteWarning.addAction(UIAlertAction(title: "Nein", style: .cancel, handler: { (action) in
|
||||||
actionDone(false)
|
actionDone(false)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.present(deleteWarning, animated: true, completion: nil)
|
self.present(deleteWarning, animated: true, completion: nil)
|
||||||
}*/
|
|
||||||
|
|
||||||
//delete.image = #imageLiteral(resourceName: "delete")
|
|
||||||
//delete.backgroundColor = #colorLiteral(red: 0.7450980544, green: 0.1568627506, blue: 0.07450980693, alpha: 1)
|
|
||||||
|
|
||||||
return UISwipeActionsConfiguration(actions: [])//delete])
|
}
|
||||||
|
|
||||||
|
delete.image = #imageLiteral(resourceName: "delete")
|
||||||
|
delete.backgroundColor = #colorLiteral(red: 0.7450980544, green: 0.1568627506, blue: 0.07450980693, alpha: 1)
|
||||||
|
|
||||||
|
let swipeConf = UISwipeActionsConfiguration(actions: [delete])
|
||||||
|
swipeConf.performsFirstActionWithFullSwipe = false
|
||||||
|
|
||||||
|
return swipeConf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user