cs193p

IBOutlet property returning “Can't unwrap Optional.None” error

旧巷老猫 提交于 2019-12-24 08:24:14
问题 I'm getting stuck on some code with the dreaded "Can't unwrap Optional.None" error in my code. I'm following the Shutterbug code from the iTunes U Stanford university course. This is the code given in Objective-C for one of the classes. http://pastebin.com/LG2k3BBW and what I've come up with in Swift; http://pastebin.com/pGtSzu6z After tracing the errors these lines in particular seem to be giving me the problems self.scrollView.zoomScale = 1.0 and self.image = nil Any advice on what's going

Setting and changing width/height of UICollectionView cells with UICollectionViewLayout

假装没事ソ 提交于 2019-12-23 23:24:16
问题 I'm using drag and drop to drag images from google onto a collection view. The images are all supposed to have equal widths. After I scroll a bit, some of the cells look like they have equal widths, but some images are too big. The collectionView has a flow layout and horizontal scroll direction. In the following gif, the images start out as if they may have the same width(I can't really tell). When I drag an image in, they resize, and you can immediately see that the two on the left no

EXC_BAD_ACCESS upon simple iPhone app startup

陌路散爱 提交于 2019-12-22 18:35:30
问题 Background: I'm trying out the "HelloPoly" assignment in the CS193P course. I've created my .xib file, and a custom Controller class. I haven't fleshed out any methods - I've only allowed IB to write the class files into xcode. Problem: Every single time I startup the application, it bombs out. When I run gdb I see it's an EXC_BAD_ACCESS error. This means I'm accessing something non-existent in memory right? Thing is, all I have is the default files created by IB and the main. Nothing more. I

Inheritance on view controller Objective c

馋奶兔 提交于 2019-12-08 10:42:08
问题 I am trying to create a generic view controller and 2 other views which both will inherit from. Now this is the generic view (what i think is relevant - if something else is needed i will add it): @interface CardGameViewController () @property (strong, nonatomic) IBOutlet UITabBarItem *TabSelection; @property (strong, nonatomic) CardMatchingGame *game; @property (strong, nonatomic) IBOutlet UIButton *resetButton; @property (weak, nonatomic) IBOutlet UILabel *scoreLable; @property (strong,

CS193P - Adding cancel button to iOS calculator

老子叫甜甜 提交于 2019-12-08 01:28:17
问题 I recently started following the online course on iPhone development from Stanford University on iTunes U. I'm trying to do the homework assignments now for the first couple of lectures. I followed through the walkthrough where I built a basic calculator, but now I'm trying the first assignment and I can't seem to work it out. It's a follows: Add a “C” button that clears everything (for example, the display in your View, the operand stack in your Model, any state you maintain in your

IOS CS193p - Why was the IBAction connection dragged to .m file and not to .h?

心已入冬 提交于 2019-12-07 02:48:35
问题 I noticed that in the calculator demo of Stanford CS193p course, the IBOutlet connection was dragged from the label to header file. However, the IBAction connection was directly created in the .m file. I tried reading through the documentation and searched on Google but couldn't find the reason behind this. I would argue that IBAction digitPressed method should be declared in the header file as well (shouldn't it be part of the interface?). I am obviously fairly new to Objective C (mostly

CS193P - Adding cancel button to iOS calculator

∥☆過路亽.° 提交于 2019-12-06 11:37:57
I recently started following the online course on iPhone development from Stanford University on iTunes U. I'm trying to do the homework assignments now for the first couple of lectures. I followed through the walkthrough where I built a basic calculator, but now I'm trying the first assignment and I can't seem to work it out. It's a follows: Add a “C” button that clears everything (for example, the display in your View, the operand stack in your Model, any state you maintain in your Controller, etc.). Make sure 3 7 C 5 results in 5 showing in the display. You will have to add API to your

EXC_BAD_ACCESS upon simple iPhone app startup

╄→尐↘猪︶ㄣ 提交于 2019-12-06 04:30:27
Background: I'm trying out the "HelloPoly" assignment in the CS193P course. I've created my .xib file, and a custom Controller class. I haven't fleshed out any methods - I've only allowed IB to write the class files into xcode. Problem: Every single time I startup the application, it bombs out. When I run gdb I see it's an EXC_BAD_ACCESS error. This means I'm accessing something non-existent in memory right? Thing is, all I have is the default files created by IB and the main. Nothing more. I've checked posted code solutions to see what's different and I'm not sure what to try next. What do

<unknown>:0: error: unexpected input file:

谁都会走 提交于 2019-12-05 18:42:47
问题 I downloaded files from a separate Stack OverFlow post, and dragged the folder into my project (as a group.) The dependancies get resolved and it shows no error for code that relies on the files, but when I try to compile I get this error: <unknown>:0: error: unexpected input file: /.../xyz.Swift Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1 It might be nothing, but the files themselves in the project navigator

IOS CS193p - Why was the IBAction connection dragged to .m file and not to .h?

我是研究僧i 提交于 2019-12-05 09:10:39
I noticed that in the calculator demo of Stanford CS193p course, the IBOutlet connection was dragged from the label to header file. However, the IBAction connection was directly created in the .m file. I tried reading through the documentation and searched on Google but couldn't find the reason behind this. I would argue that IBAction digitPressed method should be declared in the header file as well (shouldn't it be part of the interface?). I am obviously fairly new to Objective C (mostly worked in Java) so I am sure I am missing something basic. Can anyone please explain? Declaring things in